IntroductionI wroted this small Library back then when we were Testing API and i think it could be quiete Useful for some of you.
What this Library contains :
- Interactions with GumpButtons,Radiobuttons,Checkboxes,Textboxes attached on specific Gump
- Generating of GumpObject attached on specific Gump
- Validation of Gump existence
- Filtering Members for Gumpobject Subobjects
RequirementsStealth 6.0 RC 4 or Higher & ScriptDotNet DLL :
https://bitbucket.org/Stealthadmin/stealth-beta-client/downloadsGump.cs Version 1.0 or Higher :
https://bitbucket.org/jsiems/stealth-custom-librarys/downloadsVisual Studio 2012 & .NET 4.5
Function Referencepublic static uint GetGumpType(uint Serial) // Returns GumpType of specific Serial
public static uint GetSerial(uint GumpID) // Returns Serial of Specific Gump Type
public static int GetIndexbySerial(uint SerialID) // Returns Index of Gump with given Gump Serial
public static int GetIndexbyGumpID(uint GumpID) // Returns Index of Gump with Given Gump Type
public static bool ButtonClick(uint GumpID, int Value) // Fires Push the Button Action on Gump with specific Gump Type
public static bool RadioButtonClick(uint GumpID, int RadioButtonID, int Value) // Use Radiobutton on Gump with specific Gump Type
public static bool CheckBoxClick(uint GumpID, int CheckBoxID, int Value) // Use Combobox on Gump with specific Gump Type
public static bool ChangeTextField(uint GumpID, int TextFieldID, String Content) // Writes into TextBox with specific Gump Type
public static List<T> FilterbyGroup<T>(int GroupNum, List<T> list) // Filters Generic List of Generic Type T through every Object containing the required Groupnumber
public static List<T> FilterbyPage<T>(int Page,List<T> list) // Filters Generic List of Generic Type T through every Object containing the required Page
public static List<T> FilterbyElementNum<T>(int Elementnum, List<T> list) // Filters Generic List of Generic Type T through every Object containing the required Elementnum
public static List<T> FilterbyID<T>(int ID, List<T> list) // Filters Generic List of Generic Type T through every Object containing the required ID
public static List<T> FilterbyPosition<T>(int X, int Y, List<T> list) // Filters Generic List of Generic Type T through every Object containing the required Pos X & Pos Y
public static List<T> FilterbyReleasedID<T>(int ReleasedID, List<T> list) // Filters Generic List of Generic Type T through every Object containing the required ReleasedID
public static List<T> FilterbyPressedID<T>(int PressedID, List<T> list) // Filters Generic List of Generic Type T through every Object containing the required PressedID
public static List<T> FilterbyQuit<T>(int QuitID, List<T> list) // Filters Generic List of Generic Type T through every Object containing the required QuitID
public static List<T> FilterbyPageID<T>(int PageID, List<T> list) // Filters Generic List of Generic Type T through every Object containing the required PageID
public static List<T> FilterbyReturnValue<T>(int ReturnValue, List<T> list) // Filters Generic List of Generic Type T through every Object containing the required ReturnValue
public static List<T> FilterbyArtID<T>(int ArtID, List<T> list) // Filters Generic List of Generic Type T through every Object containing the required ArtID
public static List<T> FilterbyArtPosition<T>(int X, int Y, List<T> list) // Filters Generic List of Generic Type T through every Object containing the required ArtPos X & ArtPos Y
public static List<T> FilterbyHue<T>(int Hue, List<T> list) // Filters Generic List of Generic Type T through every Object containing the required Hue
public static List<T> FilterbyColor<T>(int Color, List<T> list) // Filters Generic List of Generic Type T through every Object containing the required Color
public static List<T> FilterbyStatus<T>(int Status, List<T> list) // Filters Generic List of Generic Type T through every Object containing the required Status
public static List<T> FilterbySize<T>(int width, int height, List<T> list) // Filters Generic List of Generic Type T through every Object containing the required width & height
public static List<T> FilterbyTextID<T>(int TextID, List<T> list) // Filters Generic List of Generic Type T through every Object containing the required TextID
public static List<T> FilterbyGumpID<T>(int GumpID, List<T> list) // Filters Generic List of Generic Type T through every Object containing the required GumpID
public static List<T> FilterbyDefaultTextID<T>(int DefaultTextID, List<T> list) // Filters Generic List of Generic Type T through every Object containing the required DefaultTextID
public static List<T> FilterbyLimit<T>(int Limit, List<T> list) // Filters Generic List of Generic Type T through every Object containing the required Limit
public static List<T> FilterbyClilocID<T>(int ClilocID, List<T> list) // Filters Generic List of Generic Type T through every Object containing the required ClilocID
public static List<T> FilterbBackGround<T>(int BackGround, List<T> list) // Filters Generic List of Generic Type T through every Object containing the required BackGround
public static List<T> FilterbyScrollbar<T>(int ScrollbarID, List<T> list) // Filters Generic List of Generic Type T through every Object containing the required ScrollbarID
public static List<T> FilterbyArgument<T>(String Argument, List<T> list) // Filters Generic List of Generic Type T through every Object containing the required Argument
public static List<T> FilterbyProperty<T>(int PropertyID, List<T> list) // Filters Generic List of Generic Type T through every Object containing the required PropertyID
public static TGumpInfo GetGumpObjectbySerial(uint Serial) // Returns Gump Object of Gump with given Gump Serial
public static TGumpInfo GetGumpObjectbyGumpID(uint GumpID) // Returns Gump Object of Gump with given Gump Serial
public static bool ValidateSerial(uint Serial) // Validate if Serial exist
public static bool ValidateGumpID(uint GumpID) // Validates if GumpType exist
SamplesCrafting with Sewing Kit :
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using ScriptDotNet;
using Custom.Gumps;
namespace SampleProgram
{
static class Program
{
[STAThread]
static void Main()
{
// Calls Craft Routine for normal Sewingkit and craft Studded Arms on Runuo
Library.Craft(0x0F9D, 0x0000, 0x38920ABD, 50, 16,true,true);
}
}
public static class Library
{
//*******************************************************
// Method : Craft
//*******************************************************
// Parameters :
// ushort CraftType - Item Type of your Craft Tool
// ushort CrafColor - Item Color of your Craft Tool
// uint GumpType - Gump Type of your Craft Gump
// int Category - Packet Value for your specific Category Button
// int Selection - Packet Value for your specific Selection Button
// bool CloseBefore - Selection if old Craft Gump should be closed before
// bool CloseAfter - Selection if new Craft Gump should be closed after
//
// Note : if Category = 0, Buttons from front Menu like Make Last can be used
//******************************************************
// Output :
// Boolean : returns if you were able to Use CraftMenu
//******************************************************
public static bool Craft(ushort CraftToolType, ushort CraftToolColor, uint GumpType, int Category, int Selection,bool Closebefore=false,bool CloseAfter=false)
{
uint CraftToolID = Stealth.Script_FindTypeEx(CraftToolType, CraftToolColor, Stealth.Script_GetBackpackID(), false);
if (CraftToolID > 0)
{
// We want to Clean up old Gumps?
if(Closebefore)
while(GlobalGumpHandler.GetIndexbyGumpID(GumpType) > -1)
GlobalGumpHandler.ButtonClick(GumpType, 0);
// Now we Open Gump
while (GlobalGumpHandler.GetIndexbyGumpID(GumpType) == -1)
Stealth.Script_UseObject(CraftToolID);
// If Category > 0 means you actualy want to push Category Button
if (Category > 0)
while (!GlobalGumpHandler.ButtonClick(GumpType, Category))
while (GlobalGumpHandler.GetIndexbyGumpID(GumpType) == -1) ;
while (GlobalGumpHandler.GetIndexbyGumpID(GumpType) == -1);
// We actually push the Button to Craft Something or use any featured Action by Button within Gump
while (!GlobalGumpHandler.ButtonClick(GumpType, Selection))
while (GlobalGumpHandler.GetIndexbyGumpID(GumpType) == -1) ;
// We wait Until Gump is Back or Tool got destroyed
while ((GlobalGumpHandler.GetIndexbyGumpID(GumpType) == -1) && (Stealth.Script_IsObjectExists(CraftToolID)));
// We want to kill the Gump after Craft?
if(CloseAfter)
while (GlobalGumpHandler.GetIndexbyGumpID(GumpType) > -1)
GlobalGumpHandler.ButtonClick(GumpType, 0);
return true;
}
return false;
}
}
}