public static void PlayerSearch(int curX, int curY, byte rClick) { ByteStream buffer = new ByteStream(4); if (C_GameLogic.IsInBounds()) { buffer.WriteInt32((System.Int32)Packets.ClientPackets.CSearch); buffer.WriteInt32(curX); buffer.WriteInt32(curY); buffer.WriteInt32(rClick); C_NetworkConfig.Socket.SendData(buffer.Data, buffer.Head); } buffer.Dispose(); }
public static void Packet_CheckMap(ref byte[] data) { int x; int y; int i = 0; byte needMap = 0; ByteStream buffer = new ByteStream(data); C_Variables.GettingMap = true; // Erase all players except self for (i = 1; i <= C_Variables.TotalOnline; i++) //MAX_PLAYERS { if (i != C_Variables.Myindex) { C_Player.SetPlayerMap(i, 0); } } // Erase all temporary tile values C_GameLogic.ClearTempTile(); ClearMapNpcs(); ClearMapItems(); C_DataBase.ClearBlood(); ClearMap(); // Get map num x = buffer.ReadInt32(); // Get revision y = buffer.ReadInt32(); needMap = (byte)1; // Either the revisions didn't match or we dont have the map, so we need it buffer = new ByteStream(4); buffer.WriteInt32((System.Int32)Packets.ClientPackets.CNeedMap); buffer.WriteInt32(needMap); C_NetworkConfig.Socket.SendData(buffer.Data, buffer.Head); buffer.Dispose(); }
public static void UpdateUi() { if (ReloadFrmMain == true) { ReloadFrmMain = false; } if (C_Variables.UpdateNews == true) { FrmMenu.Default.lblNews.Text = C_Variables.News; FrmMenu.Default.Text = C_Constants.GameName; FrmGame.Default.Text = C_Constants.GameName; C_Variables.UpdateNews = false; } if (PnlRegisterVisible != FrmMenu.Default.pnlRegister.Visible) { FrmMenu.Default.pnlRegister.Visible = PnlRegisterVisible; FrmMenu.Default.pnlRegister.BringToFront(); } if (DrawChar == true) { FrmMenu.Default.DrawCharacter(); DrawChar = false; } if (PnlCharCreateVisible != FrmMenu.Default.pnlNewChar.Visible) { FrmMenu.Default.pnlNewChar.Visible = PnlCharCreateVisible; FrmMenu.Default.pnlNewChar.BringToFront(); DrawChar = true; } if (Lblnextcharleft != FrmMenu.Default.lblNextChar.Left) { FrmMenu.Default.lblNextChar.Left = Lblnextcharleft; } if (!ReferenceEquals(Cmbclass, null)) { FrmMenu.Default.cmbClass.Items.Clear(); for (var i = 1; i <= (Cmbclass.Length - 1); i++) { FrmMenu.Default.cmbClass.Items.Add(Cmbclass[(int)i]); } FrmMenu.Default.cmbClass.SelectedIndex = 0; FrmMenu.Default.rdoMale.Checked = true; FrmMenu.Default.txtCharName.Focus(); Cmbclass = null; } if (PnlLoginVisible != FrmMenu.Default.pnlLogin.Visible) { FrmMenu.Default.pnlLogin.Visible = PnlLoginVisible; if (PnlLoginVisible) { FrmMenu.Default.txtLogin.Focus(); } } if (PnlCreditsVisible != FrmMenu.Default.pnlCredits.Visible) { FrmMenu.Default.pnlCredits.Visible = PnlCreditsVisible; } if (Frmmenuvisible != FrmMenu.Default.Visible) { FrmMenu.Default.Visible = Frmmenuvisible; } if (DrawCharSelect) { FrmMenu.Default.DrawCharacterSelect(); DrawCharSelect = false; } if (PnlCharSelectVisible != FrmMenu.Default.pnlCharSelect.Visible) { FrmMenu.Default.pnlCharSelect.Visible = PnlCharSelectVisible; if (PnlCharSelectVisible) { DrawCharSelect = true; } } if (Frmmaingamevisible != FrmGame.Default.Visible) { FrmGame.Default.Visible = Frmmaingamevisible; } if (C_Crafting.InitCrafting == true) { C_Crafting.CraftingInit(); C_Crafting.InitCrafting = false; } if (NeedToOpenShop == true) { C_GameLogic.OpenShop(NeedToOpenShopNum); NeedToOpenShop = false; NeedToOpenShopNum = 0; PnlShopVisible = true; } if (NeedToOpenBank == true) { C_Banks.InBank = System.Convert.ToInt32(true); PnlBankVisible = true; C_Banks.DrawBank(); NeedToOpenBank = false; } if (NeedToOpenTrade == true) { C_Trade.InTrade = true; PnlTradeVisible = true; NeedToOpenTrade = false; } if (NeedtoCloseTrade == true) { C_Trade.InTrade = false; PnlTradeVisible = false; NeedtoCloseTrade = false; } if (NeedtoUpdateTrade == true) { C_Trade.DrawTrade(); NeedtoUpdateTrade = false; } if (UpdateCharacterPanel == true) { UpdateCharacterPanel = false; } if (Pnlloadvisible != FrmMenu.Default.pnlLoad.Visible) { FrmMenu.Default.pnlLoad.Visible = Pnlloadvisible; } if (UpdateMapnames == true) { int x = 0; FrmAdmin.Default.lstMaps.Items.Clear(); for (x = 1; x <= Constants.MAX_MAPS; x++) { FrmAdmin.Default.lstMaps.Items.Add(x.ToString()); FrmAdmin.Default.lstMaps.Items[x - 1].SubItems.Add(C_Types.MapNames[x]); } UpdateMapnames = false; } if (Adminvisible == true) { FrmAdmin.Default.Visible = !FrmAdmin.Default.Visible; Adminvisible = false; } if (C_Quest.UpdateQuestChat == true) { C_Variables.DialogMsg1 = "Quest: " + Microsoft.VisualBasic.Strings.Trim(C_Quest.Quest[C_Quest.QuestNum].Name); C_Variables.DialogMsg2 = C_Quest.QuestMessage; C_Variables.DialogType = C_Constants.DialogueTypeQuest; if (C_Quest.QuestNumForStart > 0 && C_Quest.QuestNumForStart <= C_Quest.MaxQuests) { C_Quest.QuestAcceptTag = C_Quest.QuestNumForStart; } C_Variables.UpdateDialog = true; C_Quest.UpdateQuestChat = false; } if (C_Quest.UpdateQuestWindow == true) { C_Quest.LoadQuestlogBox(); C_Quest.UpdateQuestWindow = false; } if (C_Variables.UpdateDialog == true) { if (C_Variables.DialogType == C_Constants.DialogueTypeBuyhome || C_Variables.DialogType == C_Constants.DialogueTypeVisit) //house offer & visit { C_Variables.DialogButton1Text = "Accept"; C_Variables.DialogButton2Text = "Decline"; DialogPanelVisible = true; } else if (C_Variables.DialogType == C_Constants.DialogueTypeParty || C_Variables.DialogType == C_Constants.DialogueTypeTrade) { C_Variables.DialogButton1Text = "Accept"; C_Variables.DialogButton2Text = "Decline"; DialogPanelVisible = true; } else if (C_Variables.DialogType == C_Constants.DialogueTypeQuest) { C_Variables.DialogButton1Text = "Accept"; C_Variables.DialogButton2Text = "Ok"; if (C_Quest.QuestAcceptTag > 0) { C_Variables.DialogButton2Text = "Decline"; } DialogPanelVisible = true; } C_Variables.UpdateDialog = false; } if (C_EventSystem.EventChat == true) { PnlEventChatVisible = true; C_EventSystem.EventChat = false; } if (C_Variables.ShowRClick == true) { RClickname = C_Types.Player[C_Variables.MyTarget].Name; RClickX = C_Graphics.ConvertMapX(C_Variables.CurX * C_Constants.PicX); RClickY = C_Graphics.ConvertMapY(C_Variables.CurY * C_Constants.PicY); PnlRClickVisible = true; C_Variables.ShowRClick = false; } if (InitMapEditor == true) { FrmEditor_MapEditor.Default.MapEditorInit(); InitMapEditor = false; } if (InitMapProperties == true) { FrmEditor_MapEditor.Default.MapPropertiesInit(); InitMapProperties = false; } if (C_EventSystem.InitEventEditorForm == true) { FrmEditor_Events.Default.InitEventEditorForm(); // populate form // set the tabs if (FrmEditor_Events.Default.tabPages != null && FrmEditor_Events.Default.tabPages.TabPages != null) { FrmEditor_Events.Default.tabPages.TabPages.Clear(); for (var i = 1; i <= C_EventSystem.TmpEvent.PageCount; i++) { FrmEditor_Events.Default.tabPages.TabPages.Add(Conversion.Str(i)); } // items FrmEditor_Events.Default.cmbHasItem.Items.Clear(); FrmEditor_Events.Default.cmbHasItem.Items.Add("None"); for (var i = 1; i <= Constants.MAX_ITEMS; i++) { FrmEditor_Events.Default.cmbHasItem.Items.Add(i + ": " + Microsoft.VisualBasic.Strings.Trim(Types.Item[(int)i].Name)); } // variables FrmEditor_Events.Default.cmbPlayerVar.Items.Clear(); FrmEditor_Events.Default.cmbPlayerVar.Items.Add("None"); for (var i = 1; i <= C_EventSystem.MaxVariables; i++) { FrmEditor_Events.Default.cmbPlayerVar.Items.Add(i + ". " + C_EventSystem.Variables[(int)i]); } // variables FrmEditor_Events.Default.cmbPlayerSwitch.Items.Clear(); FrmEditor_Events.Default.cmbPlayerSwitch.Items.Add("None"); for (var i = 1; i <= C_EventSystem.MaxSwitches; i++) { FrmEditor_Events.Default.cmbPlayerSwitch.Items.Add(i + ". " + C_EventSystem.Switches[(int)i]); } // name FrmEditor_Events.Default.txtName.Text = C_EventSystem.TmpEvent.Name; // enable delete button if (C_EventSystem.TmpEvent.PageCount > 1) { FrmEditor_Events.Default.btnDeletePage.Enabled = true; } else { FrmEditor_Events.Default.btnDeletePage.Enabled = false; } FrmEditor_Events.Default.btnPastePage.Enabled = false; // Load page 1 to start off with C_EventSystem.CurPageNum = 1; C_EventSystem.EventEditorLoadPage(C_EventSystem.CurPageNum); FrmEditor_Events.Default.nudShowTextFace.Maximum = C_Graphics.NumFaces; FrmEditor_Events.Default.nudShowChoicesFace.Maximum = C_Graphics.NumFaces; // show the editor FrmEditor_Events.Default.Show(); C_EventSystem.InitEventEditorForm = false; } } if (OptionsVisible == true) { // show in GUI if (C_Types.Options.Music == 1) { FrmOptions.Default.optMOn.Checked = true; } else { FrmOptions.Default.optMOff.Checked = true; } if (C_Types.Options.Music == 1) { FrmOptions.Default.optSOn.Checked = true; } else { FrmOptions.Default.optSOff.Checked = true; } FrmOptions.Default.lblVolume.Text = "Volume: " + System.Convert.ToString(C_Types.Options.Volume); FrmOptions.Default.scrlVolume.Value = (int)C_Types.Options.Volume; FrmOptions.Default.cmbScreenSize.SelectedIndex = C_Types.Options.ScreenSize; if (C_Types.Options.VSync == 1) { FrmOptions.Default.chkVSync.Checked = true; } else { FrmOptions.Default.chkVSync.Checked = false; } if (C_Types.Options.UnlockFPS == 1) { FrmOptions.Default.checkBox1.Checked = true; } else { FrmOptions.Default.checkBox1.Checked = false; } if (C_Types.Options.ShowNpcBar == 1) { FrmOptions.Default.chkNpcBars.Checked = true; } else { FrmOptions.Default.chkNpcBars.Checked = false; } FrmOptions.Default.Visible = true; OptionsVisible = false; } }
public static void DrawBank() { int i = 0; int x = 0; int y = 0; int itemnum = 0; string amount = ""; Rectangle sRect = new Rectangle(); Rectangle dRect = new Rectangle(); int sprite = 0; SFML.Graphics.Color colour = new SFML.Graphics.Color(); //first render panel C_Graphics.RenderSprite(C_Graphics.BankPanelSprite, C_Graphics.GameWindow, C_UpdateUI.BankWindowX, C_UpdateUI.BankWindowY, 0, 0, C_Graphics.BankPanelGfxInfo.Width, C_Graphics.BankPanelGfxInfo.Height); //Headertext C_Text.DrawText(C_UpdateUI.BankWindowX + 140, C_UpdateUI.BankWindowY + 6, "Your Bank", SFML.Graphics.Color.White, SFML.Graphics.Color.Black, C_Graphics.GameWindow, (byte)15); //close C_Text.DrawText(C_UpdateUI.BankWindowX + 140, C_UpdateUI.BankWindowY + C_Graphics.BankPanelGfxInfo.Height - 20, "Close Bank", SFML.Graphics.Color.White, SFML.Graphics.Color.Black, C_Graphics.GameWindow, (byte)15); for (i = 1; i <= Constants.MAX_BANK; i++) { itemnum = C_GameLogic.GetBankItemNum((byte)i); if (itemnum > 0 && itemnum <= Constants.MAX_ITEMS) { sprite = Types.Item[itemnum].Pic; if (C_Graphics.ItemsGfxInfo[sprite].IsLoaded == false) { C_Graphics.LoadTexture(sprite, (byte)4); } //seeying we still use it, lets update timer ref var with_1 = ref C_Graphics.ItemsGfxInfo[sprite]; with_1.TextureTimer = C_General.GetTickCount() + 100000; sRect.Y = 0; sRect.Height = C_Constants.PicY; sRect.X = 0; sRect.Width = C_Constants.PicX; dRect.Y = C_UpdateUI.BankWindowY + C_UpdateUI.BankTop + ((C_UpdateUI.BankOffsetY + 32) * ((i - 1) / C_UpdateUI.BankColumns)); dRect.Height = C_Constants.PicY; dRect.X = C_UpdateUI.BankWindowX + C_UpdateUI.BankLeft + ((C_UpdateUI.BankOffsetX + 32) * ((i - 1) % C_UpdateUI.BankColumns)); dRect.Width = C_Constants.PicX; C_Graphics.RenderSprite(C_Graphics.ItemsSprite[sprite], C_Graphics.GameWindow, dRect.X, dRect.Y, sRect.X, sRect.Y, sRect.Width, sRect.Height); // If item is a stack - draw the amount you have if (C_GameLogic.GetBankItemValue((byte)i) > 1) { y = dRect.Top + 22; x = dRect.Left - 4; amount = System.Convert.ToString(C_GameLogic.GetBankItemValue((byte)i)); colour = SFML.Graphics.Color.White; // Draw currency but with k, m, b etc. using a convertion function if (long.Parse(amount) < 1000000) { colour = SFML.Graphics.Color.White; } else if (long.Parse(amount) > 1000000 && long.Parse(amount) < 10000000) { colour = SFML.Graphics.Color.Yellow; } else if (long.Parse(amount) > 10000000) { colour = SFML.Graphics.Color.Green; } C_Text.DrawText(x, y, C_GameLogic.ConvertCurrency(System.Convert.ToInt32(amount)), colour, SFML.Graphics.Color.Black, C_Graphics.GameWindow); } } }
public static void DrawTrade() { int i = 0; int x = 0; int y = 0; int itemnum = 0; int itempic = 0; string amount = ""; Rectangle rec = new Rectangle(); Rectangle recPos = new Rectangle(); SFML.Graphics.Color colour = new SFML.Graphics.Color(); amount = System.Convert.ToString(0); colour = SFML.Graphics.Color.White; if (!C_Variables.InGame) { return; } //first render panel C_Graphics.RenderSprite(C_Graphics.TradePanelSprite, C_Graphics.GameWindow, C_UpdateUI.TradeWindowX, C_UpdateUI.TradeWindowY, 0, 0, C_Graphics.TradePanelGfxInfo.Width, C_Graphics.TradePanelGfxInfo.Height); //Headertext C_Text.DrawText(C_UpdateUI.TradeWindowX + 70, C_UpdateUI.TradeWindowY + 6, "Your Offer", SFML.Graphics.Color.White, SFML.Graphics.Color.Black, C_Graphics.GameWindow, (byte)15); C_Text.DrawText(C_UpdateUI.TradeWindowX + 260, C_UpdateUI.TradeWindowY + 6, C_UpdateUI.Tradername + "'s Offer.", SFML.Graphics.Color.White, SFML.Graphics.Color.Black, C_Graphics.GameWindow, (byte)15); for (i = 1; i <= Constants.MAX_INV; i++) { // blt your own offer itemnum = C_Player.GetPlayerInvItemNum(C_Variables.Myindex, TradeYourOffer[i].Num); if (itemnum > 0 && itemnum <= Constants.MAX_ITEMS) { itempic = Types.Item[itemnum].Pic; if (itempic > 0 && itempic <= C_Graphics.NumItems) { if (C_Graphics.ItemsGfxInfo[itempic].IsLoaded == false) { C_Graphics.LoadTexture(itempic, (byte)4); } //seeying we still use it, lets update timer ref var with_1 = ref C_Graphics.ItemsGfxInfo[itempic]; with_1.TextureTimer = C_General.GetTickCount() + 100000; rec.Y = 0; rec.Height = C_Constants.PicY; rec.X = 0; rec.Width = C_Constants.PicX; recPos.Y = C_UpdateUI.TradeWindowY + C_UpdateUI.OurTradeY + C_UpdateUI.InvTop + ((C_UpdateUI.InvOffsetY + 32) * ((i - 1) / C_UpdateUI.InvColumns)); recPos.Height = C_Constants.PicY; recPos.X = C_UpdateUI.TradeWindowX + C_UpdateUI.OurTradeX + C_UpdateUI.InvLeft + ((C_UpdateUI.InvOffsetX + 32) * ((i - 1) % C_UpdateUI.InvColumns)); recPos.Width = C_Constants.PicX; C_Graphics.RenderSprite(C_Graphics.ItemsSprite[itempic], C_Graphics.GameWindow, recPos.X, recPos.Y, rec.X, rec.Y, rec.Width, rec.Height); // If item is a stack - draw the amount you have if (TradeYourOffer[i].Value >= 1) { y = recPos.Top + 22; x = recPos.Left - 4; // Draw currency but with k, m, b etc. using a convertion function if (double.Parse(amount) < 1000000) { colour = SFML.Graphics.Color.White; } else if (double.Parse(amount) > 1000000 && long.Parse(amount) < 10000000) { colour = SFML.Graphics.Color.Yellow; } else if (double.Parse(amount) > 10000000) { colour = SFML.Graphics.Color.Green; } amount = System.Convert.ToString(TradeYourOffer[i].Value); C_Text.DrawText(x, y, C_GameLogic.ConvertCurrency(System.Convert.ToInt32(amount)), colour, SFML.Graphics.Color.Black, C_Graphics.GameWindow); } } } }
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 FrmMainGame_KeyDown(object sender, KeyEventArgs e) { if (ChatModule.ChatInput.ProcessKey(e)) { if (e.KeyCode == Keys.Enter) { C_GameLogic.HandlePressEnter(); } } if (ChatModule.ChatInput.Active) { if (e.KeyCode == Keys.Enter) { C_GameLogic.HandlePressEnter(); } } else { if (e.KeyCode == Keys.S) { C_UpdateUI.VbKeyDown = true; } if (e.KeyCode == Keys.W) { C_UpdateUI.VbKeyUp = true; } if (e.KeyCode == Keys.A) { C_UpdateUI.VbKeyLeft = true; } if (e.KeyCode == Keys.D) { C_UpdateUI.VbKeyRight = true; } if (e.KeyCode == Keys.Down) { C_UpdateUI.VbKeyDown = true; } if (e.KeyCode == Keys.Up) { C_UpdateUI.VbKeyUp = true; } if (e.KeyCode == Keys.Left) { C_UpdateUI.VbKeyLeft = true; } if (e.KeyCode == Keys.Right) { C_UpdateUI.VbKeyRight = true; } if (e.KeyCode == Keys.ShiftKey) { C_UpdateUI.VbKeyShift = true; } if (e.KeyCode == Keys.ControlKey) { C_UpdateUI.VbKeyControl = true; } if (e.KeyCode == Keys.Alt) { C_UpdateUI.VbKeyAlt = true; } if (e.KeyCode == Keys.Space) { C_GameLogic.CheckMapGetItem(); } } }
public void Picscreen_KeyDown(object sender, KeyEventArgs e) { int num = 0; if (e.KeyCode == Keys.S) { C_UpdateUI.VbKeyDown = true; } if (e.KeyCode == Keys.W) { C_UpdateUI.VbKeyUp = true; } if (e.KeyCode == Keys.A) { C_UpdateUI.VbKeyLeft = true; } if (e.KeyCode == Keys.D) { C_UpdateUI.VbKeyRight = true; } if (e.KeyCode == Keys.ShiftKey) { C_UpdateUI.VbKeyShift = true; } if (e.KeyCode == Keys.ControlKey) { C_UpdateUI.VbKeyControl = true; } if (e.KeyCode == Keys.Alt) { C_UpdateUI.VbKeyAlt = true; } //hotbar if (e.KeyCode == Keys.NumPad1) { num = C_Types.Player[C_Variables.Myindex].Hotbar[1].Slot; if (num != 0) { C_HotBar.SendUseHotbarSlot(1); } } if (e.KeyCode == Keys.NumPad2) { num = C_Types.Player[C_Variables.Myindex].Hotbar[2].Slot; if (num != 0) { C_HotBar.SendUseHotbarSlot(2); } } if (e.KeyCode == Keys.NumPad3) { num = C_Types.Player[C_Variables.Myindex].Hotbar[3].Slot; if (num != 0) { C_HotBar.SendUseHotbarSlot(3); } } if (e.KeyCode == Keys.NumPad4) { num = C_Types.Player[C_Variables.Myindex].Hotbar[4].Slot; if (num != 0) { C_HotBar.SendUseHotbarSlot(4); } } if (e.KeyCode == Keys.NumPad5) { num = C_Types.Player[C_Variables.Myindex].Hotbar[5].Slot; if (num != 0) { C_HotBar.SendUseHotbarSlot(5); } } if (e.KeyCode == Keys.NumPad6) { num = C_Types.Player[C_Variables.Myindex].Hotbar[6].Slot; if (num != 0) { C_HotBar.SendUseHotbarSlot(6); } } if (e.KeyCode == Keys.NumPad7) { num = C_Types.Player[C_Variables.Myindex].Hotbar[7].Slot; if (num != 0) { C_HotBar.SendUseHotbarSlot(7); } } //admin if (e.KeyCode == Keys.Insert) { if (C_Types.Player[C_Variables.Myindex].Access > 0) { C_NetworkSend.SendRequestAdmin(); } } //hide gui if (e.KeyCode == Keys.F10) { C_Variables.HideGui = !C_Variables.HideGui; } if (e.KeyCode == Keys.Enter) { ChatModule.ChatInput.ProcessKey(e); C_GameLogic.HandlePressEnter(); C_GameLogic.CheckMapGetItem(); } }
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(); } }
public static void DrawActionMsg(int index) { int x = 0; int y = 0; int i = 0; int time = 0; // how long we want each message to appear switch (C_Types.ActionMsg[index].Type) { case (int)Enums.ActionMsgType.Static: time = 1500; if (C_Types.ActionMsg[index].Y > 0) { x = (int)(C_Types.ActionMsg[index].X + Conversion.Int(C_Constants.PicX / 2) - ((Microsoft.VisualBasic.Strings.Trim(C_Types.ActionMsg[index].Message).Length / 2) * 8)); y = C_Types.ActionMsg[index].Y - Conversion.Int(C_Constants.PicY / 2) - 2; } else { x = (int)(C_Types.ActionMsg[index].X + Conversion.Int(C_Constants.PicX / 2) - ((Microsoft.VisualBasic.Strings.Trim(C_Types.ActionMsg[index].Message).Length / 2) * 8)); y = C_Types.ActionMsg[index].Y - Conversion.Int(C_Constants.PicY / 2) + 18; } break; case (int)Enums.ActionMsgType.Scroll: time = 1500; if (C_Types.ActionMsg[index].Y > 0) { x = (int)(C_Types.ActionMsg[index].X + Conversion.Int(C_Constants.PicX / 2) - ((Microsoft.VisualBasic.Strings.Trim(C_Types.ActionMsg[index].Message).Length / 2) * 8)); y = (int)(C_Types.ActionMsg[index].Y - Conversion.Int(C_Constants.PicY / 2) - 2 - (C_Types.ActionMsg[index].Scroll * 0.6)); C_Types.ActionMsg[index].Scroll = C_Types.ActionMsg[index].Scroll + 1; } else { x = (int)(C_Types.ActionMsg[index].X + Conversion.Int(C_Constants.PicX / 2) - ((Microsoft.VisualBasic.Strings.Trim(C_Types.ActionMsg[index].Message).Length / 2) * 8)); y = (int)(C_Types.ActionMsg[index].Y - Conversion.Int(C_Constants.PicY / 2) + 18 + (C_Types.ActionMsg[index].Scroll * 0.6)); C_Types.ActionMsg[index].Scroll = C_Types.ActionMsg[index].Scroll + 1; } break; case (int)Enums.ActionMsgType.Screen: time = 3000; // This will kill any action screen messages that there in the system for (i = byte.MaxValue; i >= 1; i--) { if (C_Types.ActionMsg[i].Type == (int)Enums.ActionMsgType.Screen) { if (i != index) { C_GameLogic.ClearActionMsg((byte)index); index = i; } } } x = (int)((FrmGame.Default.picscreen.Width / 2) - ((Microsoft.VisualBasic.Strings.Trim(C_Types.ActionMsg[index].Message).Length / 2) * 8)); y = 425; break; } x = C_Graphics.ConvertMapX(x); y = C_Graphics.ConvertMapY(y); if (C_General.GetTickCount() < C_Types.ActionMsg[index].Created + time) { DrawText(x, y, C_Types.ActionMsg[index].Message, GetSfmlColor((byte)(C_Types.ActionMsg[index].Color)), Color.Black, C_Graphics.GameWindow); } else { C_GameLogic.ClearActionMsg((byte)index); } }
public static void ProcessWeather() { int i = 0; int x; if (CurrentWeather > 0 && CurrentWeather <= (int)Enums.WeatherType.Fog) { if (CurrentWeather == (int)Enums.WeatherType.Rain || CurrentWeather == (int)Enums.WeatherType.Storm) { PlayWeatherSound("Rain.ogg", true); } //Setup a particle for (i = 1; i <= MaxWeatherParticles; i++) { if (WeatherParticle[i].InUse == 0) { WeatherParticle[i].InUse = 1; WeatherParticle[i].Type = CurrentWeather; if (C_GameLogic.Rand(1, 3) == 1) { WeatherParticle[i].Velocity = C_GameLogic.Rand(8, 14); WeatherParticle[i].X = ((C_Variables.TileView.Left * 32) - 32); WeatherParticle[i].Y = ((C_Variables.TileView.Top * 32) + C_GameLogic.Rand(-32, (int)C_Graphics.GameWindow.Size.Y)); } else { WeatherParticle[i].Velocity = C_GameLogic.Rand(10, 15); WeatherParticle[i].X = ((C_Variables.TileView.Left * 32) + C_GameLogic.Rand(-32, (int)C_Graphics.GameWindow.Size.X)); WeatherParticle[i].Y = ((C_Variables.TileView.Top * 32) - 32); } } else { WeatherParticle[i].Type = CurrentWeather; } } } else { StopWeatherSound(); for (i = 1; i <= MaxWeatherParticles; i++) { if (WeatherParticle[i].InUse == 1) { WeatherParticle[i].InUse = 0; } } } if (CurrentWeather == (int)Enums.WeatherType.Storm) { x = C_GameLogic.Rand(1, 400 - CurrentWeatherIntensity); if (x == 1) { //Draw Thunder DrawThunder = C_GameLogic.Rand(15, 22); C_Sound.PlayExtraSound("Thunder.ogg"); } } for (i = 1; i <= MaxWeatherParticles; i++) { if (WeatherParticle[i].InUse == 1) { if (WeatherParticle[i].X > C_Variables.TileView.Right * 32 || WeatherParticle[i].Y > C_Variables.TileView.Bottom * 32) { //WeatherParticle[i].InUse = 0; if (C_GameLogic.Rand(1, 3) == 1) { WeatherParticle[i].X = (C_Variables.TileView.Left * 32) - 32; WeatherParticle[i].Y = (C_Variables.TileView.Top * 32) + C_GameLogic.Rand(-32, (int)C_Graphics.GameWindow.Size.Y); } else { WeatherParticle[i].X = (C_Variables.TileView.Left * 32) + C_GameLogic.Rand(-32, (int)C_Graphics.GameWindow.Size.X); WeatherParticle[i].Y = (C_Variables.TileView.Top * 32) - 32; } } else { WeatherParticle[i].X = WeatherParticle[i].X + WeatherParticle[i].Velocity; WeatherParticle[i].Y = WeatherParticle[i].Y + WeatherParticle[i].Velocity; } } } }