Jump to content

Recommended Posts

Ive Been trying to add Restock Functionality to the TSM Plugin But i am getting alot of errors in VS. Could someone help me out.

I have removed Mailbox Functionality Because it looks very bottish.

 

using System;
using System.Threading;
using robotManager.Helpful;
using robotManager.Products;
using wManager.Plugin;
using wManager.Wow.Bot.Tasks;
using wManager.Wow.Helpers;

// Token: 0x02000002 RID: 2
public class Main : IPlugin
{
    // Token: 0x06000001 RID: 1 RVA: 0x00002050 File Offset: 0x00000250
    public void Initialize()
    {
        this._isLaunched = true;
        TSMAuction.Load();
        this.WaitAfter = TSMAuction.CurrentSetting.WaitAfter;
        this.WaitBefore = TSMAuction.CurrentSetting.WaitBefore;
        this.AuctionerId = TSMAuction.CurrentSetting.AuctionerId;

 

        this.TabNumberAuctioning = TSMAuction.CurrentSetting.TabNumberAuctioning;
        this.PositionAuctioner = new Vector3(TSMAuction.CurrentSetting.PositionAuctionerX, TSMAuction.CurrentSetting.PositionAuctionerY, TSMAuction.CurrentSetting.PositionAuctionerZ, "None");
        this.Loop = TSMAuction.CurrentSetting.Loop;
        this.DepositGuildBank = TSMAuction.CurrentSetting.DepositGuildBank;
        this.GuildBankId = TSMAuction.CurrentSetting.GuildBankId;
        this.GuildBankPosition = new Vector3(TSMAuction.CurrentSetting.GuildBankPositionX, TSMAuction.CurrentSetting.GuildBankPositionY, TSMAuction.CurrentSetting.GuildBankPositionZ, "None");
        this.MaxPostCount = TSMAuction.CurrentSetting.MaxPostCount;
        this.SafeGoldCount = TSMAuction.CurrentSetting.SafeGoldCount;
        this.RestockItems = TSMAuction.CurrentSetting.TSMRestockItems;
        while (this._isLaunched)
        {
            Thread.Sleep(this.WaitBefore);
            this.InteractWithNPCAndCancell();
            while (!this.CancelButtonVisible() && !this.DoneCanceling())
            {
                Thread.Sleep(3000);
            }
            this.CancelAllItems();
            this.SellItems();
            Thread.Sleep(this.WaitAfter + 150);
        }
    }

    // Token: 0x06000002 RID: 2 RVA: 0x00002204 File Offset: 0x00000404
    public void InteractWithNPCAndCancell()
    {
        while (!this.AuctionFrameVisible())
        {
            Logging.WriteDebug("Trying to Interact with NPC");
            GoToTask.ToPositionAndIntecractWithNpc(this.PositionAuctioner, this.AuctionerId, -1, false, null, false);
            Thread.Sleep(3000 + Usefuls.Latency);
        }
        Logging.WriteDebug("Starting Cancel Scan");
        Lua.RunMacroText("/click AuctionFrameTab" + this.TabNumberAuctioning);
        Thread.Sleep(1000 + Usefuls.Latency);
        Lua.RunMacroText("/click TSMStartCancelScanButton");
    }

    // Token: 0x06000003 RID: 3 RVA: 0x00002294 File Offset: 0x00000494
    private bool CancelButtonVisible()
    {
        return Lua.LuaDoString<bool>("return TSMAuctioningCancelButton:IsEnabled()", "");
    }

    // Token: 0x06000004 RID: 4 RVA: 0x000022C0 File Offset: 0x000004C0
    private bool AuctionFrameVisible()
    {
        return Lua.LuaDoString<bool>("return AuctionFrame:IsVisible()", "");
    }


    // Token: 0x06000006 RID: 6 RVA: 0x00002318 File Offset: 0x00000518
    private bool PostButtonEnabled()
    {
        return Lua.LuaDoString<bool>("return TSMAuctioningPostButton:IsEnabled()", "");
    }

    private const int V = 24;
    private const int V1 = 25;
    private const int V2 = 26;

    public object RestockItems { get; private set; }

    // Token: 0x06000007 RID: 7 RVA: 0x00002344 File Offset: 0x00000544
    private void CancelAllItems()
    {
        for (int i = 0; i < this.MaxPostCount; i++)
        {
            bool flag = this.DoneCanceling();
            if (flag)
            {
                Logging.WriteDebug("Done Canceling");
                break;
            }
            bool flag2 = this.CancelButtonVisible();
            if (flag2)
            {
                wManager.Wow.Helpers.Keybindings.PressKeybindings(wManager.Wow.Enums.Keybindings.ACTIONBUTTON1, 1000);
            }
            Logging.WriteDebug("Done Canceling" + this.DoneCanceling().ToString());
            Thread.Sleep(2000 + Usefuls.Latency);
        }
    }


    // Token: 0x06000009 RID: 9 RVA: 0x00002440 File Offset: 0x00000640
    private void SellItems()
    {
        Logging.WriteDebug("Let's sell items!");
        GoToTask.ToPositionAndIntecractWithNpc(this.PositionAuctioner, this.AuctionerId, -1, false, null, false);
        Thread.Sleep(1000 + Usefuls.Latency);
        Lua.RunMacroText("/click AuctionFrameTab" + this.TabNumberAuctioning);
        Thread.Sleep(1000 + Usefuls.Latency);
        Lua.RunMacroText("/click TSMStartPostScanButton");
        while (!this.PostButtonEnabled() && !this.DonePosting())
        {
            Thread.Sleep(3000);
        }
        for (int i = 0; i < 100; i++)
        {
            bool flag = this.PostButtonEnabled();
            if (flag)
            {
                wManager.Wow.Helpers.Keybindings.PressKeybindings(wManager.Wow.Enums.Keybindings.ACTIONBUTTON2, 1000);
            }
            else
            {
                bool flag2 = this.DonePosting();
                if (flag2)
                {
                    break;
                }
            }
            Thread.Sleep(2000 + Usefuls.Latency);
        }
        wManager.Wow.Helpers.Keybindings.PressKeybindings(wManager.Wow.Enums.Keybindings.ACTIONBUTTON3, 1000);
        bool depositGuildBank = this.DepositGuildBank;
        if (depositGuildBank)
        {
            Logging.WriteDebug("Let's deposit some Gold");
            GoToTask.ToPositionAndIntecractWithGameObject(this.GuildBankPosition, this.GuildBankId, -1, false, null);
            Thread.Sleep(2000 + Usefuls.Latency);
            Lua.RunMacroText("/run DepositGuildBankMoney(GetMoney() - " + this.SafeGoldCount.ToString() + "0000)");
        }
        bool flag3 = !this.Loop;
        if (flag3)
        {
            Logging.WriteDebug("End of my work");
            Products.ProductStop();
        }
        Lua.RunMacroText("/click AuctionFrameTab1");
        Thread.Sleep(1000);
        Lua.RunMacroText("/click BrowseCloseButton");
        Thread.Sleep(1000);
    }

}
        //craft next button enabled

        private bool TSMCraftNextButtonEnabled()
            { return Lua.LuaDoString<bool>("return TSMCraftNextButton:IsEnabled()", "");
            }

        //craft next button disabled
        private bool TSMCraftNextButtonDisabled()
            { return Lua.LuaDoString<bool>("return TSMCraftNextButton:IsDisabled()", "");
            }
        //Restock Code Goes Here
     private void Restocking()
    { 
            bool resstockItems = this.ResstockItems;
         if (resstockItems)
         {
              Logging.WriteDebug("Restocking Items");
              Thread.Sleep(2000);
              wManager.Wow.Helpers.Keybindings.PressKeybindings(wManager.Wow.Enums.Keybindings.ACTIONBUTTON4, 1000);
              Lua.RunMacroText("/click TSMGroups");
              Thread.Sleep(2000);
              Lua.RunMacroText("/click TSMRestockGroups");
              Thread.Sleep(2000);
        {
            {
                bool flag = this.TSMCraftNextButtonEnabled();
                if (flag)
            }
            {
                Lua.RunMacroText("/click TSMCraftNextButton");
            }
            else
            {
                bool flag2 = this.TSMCraftNextButtonDisabled();
                if (flag2)
                {
                    break;
                    {
                    }
                    Thread.Sleep(2000);
                }

            }
         }
        }
     }
    
        //Restock Code Ends Here
    // Token: 0x0600000A RID: 10 RVA: 0x000025DC File Offset: 0x000007DC
    private bool DoneCanceling()
    {
        bool flag = Lua.LuaDoString<bool>("local f=TSMInfo.statusBar:GetText() return f == 'Done Canceling'", "");
        bool result;
        if (flag)
        {
            result = true;
        }
        else
        {
            bool flag2 = Lua.LuaDoString<bool>("local f=TSMInfo.statusBar:GetText() return f == 'Abbrechen abgeschlossen'", "");
            result = flag2;
        }
        return result;
          }

    // Token: 0x0600000B RID: 11 RVA: 0x00002620 File Offset: 0x00000820
    private bool DonePosting()
    {
        bool flag = Lua.LuaDoString<bool>("local f=TSMInfo.statusBar:GetText() return f == 'Done Posting'", "");
        bool result;
        if (flag)
        {
            result = true;
          }
        else
        {
            bool flag2 = Lua.LuaDoString<bool>("local f=TSMInfo.statusBar:GetText() return f == 'Erstellen abgeschlossen'", "");
            result = flag2;
        }
        return result;
    }

    // Token: 0x0600000C RID: 12 RVA: 0x00002663 File Offset: 0x00000863
    public void Dispose()
    {
        this._isLaunched = false;
    }

    // Token: 0x0600000D RID: 13 RVA: 0x0000266D File Offset: 0x0000086D
    public void Settings()
    {
        TSMAuction.Load();
        TSMAuction.CurrentSetting.ToForm();
        TSMAuction.CurrentSetting.Save();
    }
bool CraftNextButtonDisabled()
{
    throw new NotImplementedException();
}
bool CraftNextButtonDisabled()
{
    throw new NotImplementedException();
}

// Token: 0x04000001 RID: 1
private bool _isLaunched;

    // Token: 0x04000002 RID: 2
    private bool DepositGuildBank;

    // Token: 0x04000003 RID: 3
    private bool Loop;

    // Token: 0x04000004 RID: 4
    private int AuctionerId;

    // Token: 0x04000006 RID: 6
    private int GuildBankId;

    // Token: 0x04000007 RID: 7
    private int WaitAfter;

    // Token: 0x04000008 RID: 8
    private int WaitBefore;

    // Token: 0x04000009 RID: 9
    private int MaxPostCount;

    //restockone
    private int MaxRestockCount;

    // Token: 0x0400000A RID: 10
    private int SafeGoldCount;

    // Token: 0x0400000B RID: 11
    private Vector3 PositionAuctioner;
    
    // Token: 0x0400000D RID: 13
    private Vector3 GuildBankPosition;

    // Token: 0x0400000E RID: 14
    private string TabNumberAuctioning;
}
private bool ResstockItems;
private bool restockItems;
 

 

ive also tried to make a true and false button to turn it on and off

using System;
using System.ComponentModel;
using System.IO;
using robotManager.Helpful;
using wManager.Wow.Helpers;
using wManager.Wow.ObjectManager;

// Token: 0x02000003 RID: 3
public class TSMAuction : Settings
{
    internal int MaxRestockCount;
    internal object TSMRestockItems;

    // Token: 0x0600000F RID: 15 RVA: 0x00002698 File Offset: 0x00000898
    public TSMAuction()
    {
        this.AuctionerId = 17627;
        this.PositionAuctionerX = 9648.251;
        this.PositionAuctionerY = -7129.26;
        this.PositionAuctionerZ = 16.7754;
        this.Loop = false;
        this.DepositGuildBank = false;
        this.GuildBankId = 187390;
        this.GuildBankPositionX = 9525.154;
        this.GuildBankPositionY = -7223.089;
        this.GuildBankPositionZ = 17.4742;
        this.TabNumberAuctioning = "5";
        this.WaitAfter = 5000;
        this.WaitBefore = 5000;
        this.MaxPostCount = 100;
        this.SafeGoldCount = 500;
        this.RestockItems = false;
    }

    // Token: 0x17000001 RID: 1
    // (get) Token: 0x06000010 RID: 16 RVA: 0x000027AA File Offset: 0x000009AA
    // (set) Token: 0x06000011 RID: 17 RVA: 0x000027B1 File Offset: 0x000009B1
    public static TSMAuction CurrentSetting { get; set; }

    // Token: 0x06000012 RID: 18 RVA: 0x000027BC File Offset: 0x000009BC
    public bool Save()
    {
        bool result;
        try
        {
            result = base.Save(Settings.AdviserFilePathAndName("TSMAuction", ObjectManager.Me.Name + "." + Usefuls.RealmName));
        }
        catch (Exception arg)
        {
            Logging.WriteDebug("Dungeoner => Save(): " + arg);
            result = false;
        }
        return result;
    }

    // Token: 0x06000013 RID: 19 RVA: 0x00002820 File Offset: 0x00000A20
    public static bool Load()
    {
        try
        {
            bool flag = File.Exists(Settings.AdviserFilePathAndName("TSMAuction", ObjectManager.Me.Name + "." + Usefuls.RealmName));
            if (flag)
            {
                TSMAuction.CurrentSetting = Settings.Load<TSMAuction>(Settings.AdviserFilePathAndName("TSMAuction", ObjectManager.Me.Name + "." + Usefuls.RealmName));
                return true;
            }
            TSMAuction.CurrentSetting = new TSMAuction();
        }
        catch (Exception arg)
        {
            Logging.WriteDebug("TSMAuction => Load(): " + arg);
        }
        return false;
    }

    // Token: 0x17000002 RID: 2
    // (get) Token: 0x06000014 RID: 20 RVA: 0x000028C8 File Offset: 0x00000AC8
    // (set) Token: 0x06000015 RID: 21 RVA: 0x000028D0 File Offset: 0x00000AD0
    [Category("General Configuration")]
    [DisplayName("AuctionerID")]
    [Description("")]
    public int AuctionerId { get; set; }

    // Token: 0x17000003 RID: 3
    // (get) Token: 0x06000016 RID: 22 RVA: 0x000028D9 File Offset: 0x00000AD9
    // (set) Token: 0x06000017 RID: 23 RVA: 0x000028E1 File Offset: 0x00000AE1
    [Category("General Configuration")]
    [DisplayName("Wait Time After(ms)")]
    [Description("")]
    public int WaitAfter { get; set; }

    // Token: 0x17000004 RID: 4
    // (get) Token: 0x06000018 RID: 24 RVA: 0x000028EA File Offset: 0x00000AEA
    // (set) Token: 0x06000019 RID: 25 RVA: 0x000028F2 File Offset: 0x00000AF2
    [Category("General Configuration")]
    [DisplayName("Wait Time Before(ms)")]
    [Description("")]
    public int WaitBefore { get; set; }

    // Token: 0x17000005 RID: 5
    // (get) Token: 0x0600001A RID: 26 RVA: 0x000028FB File Offset: 0x00000AFB
    // (set) Token: 0x0600001B RID: 27 RVA: 0x00002903 File Offset: 0x00000B03
    [Category("General Configuration")]
    [DisplayName("Auctioning Tab Number")]
    [Description("")]
    public string TabNumberAuctioning { get; set; }

    // Token: 0x17000006 RID: 6
    // (get) Token: 0x0600001C RID: 28 RVA: 0x0000290C File Offset: 0x00000B0C
    // (set) Token: 0x0600001D RID: 29 RVA: 0x00002914 File Offset: 0x00000B14
    [Category("General Configuration")]
    [DisplayName("Position Auctioner X")]
    [Description("")]
    public double PositionAuctionerX { get; set; }

    // Token: 0x17000007 RID: 7
    // (get) Token: 0x0600001E RID: 30 RVA: 0x0000291D File Offset: 0x00000B1D
    // (set) Token: 0x0600001F RID: 31 RVA: 0x00002925 File Offset: 0x00000B25
    [Category("General Configuration")]
    [DisplayName("Position Auctioner Y")]
    [Description("")]
    public double PositionAuctionerY { get; set; }

    // Token: 0x17000008 RID: 8
    // (get) Token: 0x06000020 RID: 32 RVA: 0x0000292E File Offset: 0x00000B2E
    // (set) Token: 0x06000021 RID: 33 RVA: 0x00002936 File Offset: 0x00000B36
    [Category("General Configuration")]
    [DisplayName("Position Auctioner Z")]
    [Description("")]
    public double PositionAuctionerZ { get; set; }

    // Token: 0x1700000D RID: 13
    // (get) Token: 0x0600002A RID: 42 RVA: 0x00002983 File Offset: 0x00000B83
    // (set) Token: 0x0600002B RID: 43 RVA: 0x0000298B File Offset: 0x00000B8B
    [Category("General Configuration")]
    [DisplayName("Loop")]
    [Description("")]
    public bool Loop { get; set; }

    // Token: 0x1700000E RID: 14
    // (get) Token: 0x0600002C RID: 44 RVA: 0x00002994 File Offset: 0x00000B94
    // (set) Token: 0x0600002D RID: 45 RVA: 0x0000299C File Offset: 0x00000B9C
    [Category("General Configuration")]
    [DisplayName("Max Post Count")]
    [Description("")]
    public int MaxPostCount { get; set; }

    // Token: 0x1700000F RID: 15
    // (get) Token: 0x0600002E RID: 46 RVA: 0x000029A5 File Offset: 0x00000BA5
    // (set) Token: 0x0600002F RID: 47 RVA: 0x000029AD File Offset: 0x00000BAD
    [Category("Guild Bank")]
    [DisplayName("Deposit Guild Bank")]
    [Description("")]
    public bool DepositGuildBank { get; set; }

    // Token: 0x17000010 RID: 16
    // (get) Token: 0x06000030 RID: 48 RVA: 0x000029B6 File Offset: 0x00000BB6
    // (set) Token: 0x06000031 RID: 49 RVA: 0x000029BE File Offset: 0x00000BBE
    [Category("Guild Bank")]
    [DisplayName("Quantity Gold after deposit")]
    [Description("")]
    public int SafeGoldCount { get; set; }

    // Token: 0x17000011 RID: 17
    // (get) Token: 0x06000032 RID: 50 RVA: 0x000029C7 File Offset: 0x00000BC7
    // (set) Token: 0x06000033 RID: 51 RVA: 0x000029CF File Offset: 0x00000BCF
    [Category("Guild Bank")]
    [DisplayName("Guild Bank ID")]
    [Description("")]
    public int GuildBankId { get; set; }

    // Token: 0x17000012 RID: 18
    // (get) Token: 0x06000034 RID: 52 RVA: 0x000029D8 File Offset: 0x00000BD8
    // (set) Token: 0x06000035 RID: 53 RVA: 0x000029E0 File Offset: 0x00000BE0
    [Category("Guild Bank")]
    [DisplayName("Guild Bank Position X")]
    [Description("")]
    public double GuildBankPositionX { get; set; }

    // Token: 0x17000013 RID: 19
    // (get) Token: 0x06000036 RID: 54 RVA: 0x000029E9 File Offset: 0x00000BE9
    // (set) Token: 0x06000037 RID: 55 RVA: 0x000029F1 File Offset: 0x00000BF1
    [Category("Guild Bank")]
    [DisplayName("Guild Bank Position Y")]
    [Description("")]
    public double GuildBankPositionY { get; set; }

    // Token: 0x17000014 RID: 20
    // (get) Token: 0x06000038 RID: 56 RVA: 0x000029FA File Offset: 0x00000BFA
    // (set) Token: 0x06000039 RID: 57 RVA: 0x00002A02 File Offset: 0x00000C02
    [Category("Guild Bank")]
    [DisplayName("Guild Bank Position Z")]
    [Description("")]
    public double GuildBankPositionZ { get; set; }

    //restock items settings
    [Category("General Configuration")]
    [DisplayName("Restock")]
    [Description("")]
    public bool RestockItems { get; set; }
}
 

Link to comment
https://wrobot.eu/forums/topic/9845-tsm/
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...