Skip to content
MPGHThe Dark Arts
/
RegisterLog in
Forum
Community
What's NewLatest posts across the boardTrendingHottest threads right nowSubscribedThreads you follow
Discussion
GeneralIntroductionsEntertainmentDebate FortFlaming & Rage
Board
News & AnnouncementsMPGH TimesSuggestions & HelpGiveaways
More Sections
Art & Graphic DesignProgrammingHackingCryptocurrency
Hacks & Cheats
Games
ValorantCS2 / CS:GOCall of Duty / WarzoneFortniteApex LegendsEscape From Tarkov
+14 moreLeague of LegendsGTA VMinecraftRustROTMGBattlefieldTroveBattleOnCombat ArmsCrossFireBlackshotRuneScapeDayZDead by Daylight
Resources
Game Hacking TutorialsReverse EngineeringGeneral Game HackingAnti-CheatConsole Game Hacking
Tools
Game Hacking ToolsTrainers & CheatsHack/Release NewsNew
Submit a release →Share your cheat, tool, or config with the community.
AINEW
AI Tools
General & DiscussionPrompt EngineeringLLM JailbreaksHotAI Agents & AutomationLocal / Open Models
AI × Gaming
AI Aimbots & VisionML Anti-CheatGame Bots & Automation
Create
AI Coding / Vibe CodingAI Art & MediaAI Voice & TTS
The AI frontier →Where game hacking meets modern machine learning. Jump in.
Marketplace
Buy & Sell
SellingBuyingTradingUser Services
Trust & Safety
Middleman LoungeMarketplace TalkVouch Copy Profiles
Money
Cryptocurrency TalkCurrency ExchangeWork & Job Offers
Start selling →List accounts, services, and goods. Use the middleman to trade safe.
MPGH The Dark Arts

A community for offensive security research, reverse engineering, and AI.

Community

ForumMarketplaceSearch

Account

RegisterLog in

Legal

Privacy PolicyForum RulesHelp & FAQ
© 2026 MPGH · All rights reserved.Built by the community, for the community. For educational purposes onlyContent is shared for security research and education — we don't condone illegal use. You're responsible for complying with applicable laws. Use at your own risk.
Home › Forum › MultiPlayer Game Hacks & Cheats › Realm of the Mad God Hacks & Cheats › Realm of the Mad God Help & Requests › Problems with ChangeTradePacket

Problems with ChangeTradePacket

Posts 1–4 of 4 · Page 1 of 1
ArkMods
ArkMods
Problems with ChangeTradePacket
Ok, so I am having a problem when setting the values of a new ChangeTradePacket() called selectMyItems to true/false its giving me an error in my hook packet method, even when I tried doing something simple like:
Code:
 @hookPacket(PacketType.TRADEREQUESTED)
    onTradeRequested(client: Client, tradeRequestPacket: TradeRequestedPacket): void {
          const selectMyItems = new ChangeTradePacket();
          console.log('created object selectMyItems')
          selectMyItems.offer[0] = true; //Note there is an item in slot 1
          console.log('settrue');
          selectMyItems.offer[1] = false;
          console.log('setfalse');
          selectMyItems.offer[2] = false;
          console.log('setfalse');
          selectMyItems.offer[3] = false;
          console.log('setfalse');
          selectMyItems.offer[4] = false;
          console.log('setfalse');
          selectMyItems.offer[5] = false;
          console.log('setfalse');
          selectMyItems.offer[6] = false;
          console.log('setfalse');
          selectMyItems.offer[7] = false;
          console.log('setfalse');
          client.packetio.sendPacket(selectMyItems);
}
But to no success, it seems like whenever I try to assign a bool to it
Heres my full source if it helps:
Code:
import { NrPlugin, HookPacket, Packet, PacketType, Client, Log } from './../core/plugin-module';
import { WorldPosData } from './../networking/data/world-pos-data';
import { NewTickPacket } from './../networking/packets/incoming/newtick-packet';
//Trade packets
import { TradeRequestedPacket } from './../networking/packets/incoming/trade-requested-packet';
import { RequestTradePacket } from './../networking/packets/outgoing/request-trade-packet';
import { TradeStartPacket } from './../networking/packets/incoming/trade-start-packet';
import { CancelTradePacket } from './../networking/packets/outgoing/cancel-trade-packet'
import { TradeChangedPacket } from './../networking/packets/incoming/trade-changed'
import { ChangeTradePacket } from './../networking/packets/outgoing/change-trade-packet'
//Text packets
import { TextPacket } from './../networking/packets/incoming/text-packet';
import { PlayerTextPacket } from './../networking/packets/outgoing/playertext-packet';
//I am going to import these from a file later.
const itemSelling = 9052;
const quantitySelling = 1;
const itemWanted = 2985;
const quantityWanted = 2;
const loop = false;
const selectMyItems = new ChangeTradePacket();
const exitTrade = new CancelTradePacket();
var mySelectedItems = 0;
const path = [
    { x: 136.5, y: 146.5 } // bottom-left
];

 @NRPlugin({
    name: 'CL TradeBot',
    author: 'Ark'
})
export default class TradeBot {
partnerQuantity: number;
partnerHasItems: boolean;

/*
//setting up messages and trades from file trades.JSON
  message: array;
  item: array;
  amnt: array;
    item[0] = 'Potion Of Life'
    item[1] = 'Potion Of Defence'
    message[0] = 'Selling ' + item[0] + 'for ' + item[1] '@' + client.playerData.name;
*/
    private players: {
        [id: number]: any[]
    };

    constructor() {
        this.players = {};
    }

    @hookPacket(PacketType.NEWTICK)
    onNewTick(client: Client, newTickPacket: NewTickPacket): void {
        if (!this.players[client.playerData.objectId]) {
            this.players[client.playerData.objectId] = path.slice();
        }
        if (!client.nextPos) {
            const wp = new WorldPosData();
            const point = this.players[client.playerData.objectId].pop();
            this.players[client.playerData.objectId].unshift(point);
            wp.x = point.x;
            wp.y = point.y;
            client.nextPos = wp;
        }
      }
    @hookPacket(PacketType.TRADEREQUESTED)
    onTradeRequested(client: Client, tradeRequestPacket: TradeRequestedPacket): void {
      console.log('New trade from: ' + tradeRequestPacket.name);
      // needs if statment
      const trade = new RequestTradePacket();
      trade.name = tradeRequestPacket.name;
      client.packetio.sendPacket(trade);
      console.log('Accepted trade request from: ' + tradeRequestPacket.name);

    }
    @hookPacket(PacketType.TRADESTART)
    onTradeStart(client: Client, tradeStartPacket: TradeStartPacket): void{
      this.partnerQuantity = 0;
      console.log('Partner Items: ')
      for(let i = 4; i < tradeStartPacket.partnerItems.length; i++){
      console.log(i-3 + ': ' + tradeStartPacket.partnerItems[i].item);
      }

      console.log('My Items: ')
      for(let i = 4; i < tradeStartPacket.clientItems.length; i++){
      console.log(i-3 + ': ' + tradeStartPacket.clientItems[i].item);
      }
      //checking the partner's inv for items
      for(let i = 4; i < tradeStartPacket.partnerItems.length; i++){
        if(tradeStartPacket.partnerItems[i].item == itemWanted){
          this.partnerQuantity++;
        }
      }

      console.log('Partner has: ' + this.partnerQuantity + 'x' + itemWanted)
      if (this.partnerQuantity >= quantityWanted){
          console.log('Partner has desired items!')
          this.partnerHasItems = true;
          mySelectedItems = 0;
          const selectMyItems = new ChangeTradePacket();
          console.log('created object selectMyItems')
          selectMyItems.offer[0] = false;
          console.log('setfalse');
          selectMyItems.offer[1] = false;
          console.log('setfalse');
          selectMyItems.offer[2] = false;
          console.log('setfalse');
          selectMyItems.offer[3] = false;
          console.log('setfalse');
          selectMyItems.offer[4] = false;
          console.log('setfalse');
          selectMyItems.offer[5] = false;
          console.log('setfalse');
          selectMyItems.offer[6] = false;
          console.log('setfalse');
          selectMyItems.offer[7] = false;
          console.log('setfalse');
          for(let m = 4; m <= tradeStartPacket.clientItems.length; m++){
            if(tradeStartPacket.clientItems[m].item == itemSelling && mySelectedItems <= quantitySelling){
              console.log('I select slot: ', m-3);
              selectMyItems.offer[m-4] = true;
              mySelectedItems++;
            }
          }
          console.log('Selecting items!')
          client.packetio.sendPacket(selectMyItems);
        }else{
          console.log('Partner is a cheap cuck who trades without items!');
          client.packetio.sendPacket(exitTrade);}
      }
  @hookPacket(PacketType.TRADECHANGED)
  onTradeChanged(client: Client, tradeChanged: TradeChangedPacket): void{
    if (this.partnerHasItems){
      console.log('Checking for partner item selection!')
    }
  }
}
#1 · 8y ago
Killer Be Killed
Killer Be Killed
Quote Originally Posted by ArkMods View Post
Ok, so I am having a problem when setting the values of a new ChangeTradePacket() called selectMyItems to true/false its giving me an error in my hook packet method, even when I tried doing something simple like:
Code:
 @hookPacket(PacketType.TRADEREQUESTED)
    onTradeRequested(client: Client, tradeRequestPacket: TradeRequestedPacket): void {
          const selectMyItems = new ChangeTradePacket();
          console.log('created object selectMyItems')
          selectMyItems.offer[0] = true; //Note there is an item in slot 1
          console.log('settrue');
          selectMyItems.offer[1] = false;
          console.log('setfalse');
          selectMyItems.offer[2] = false;
          console.log('setfalse');
          selectMyItems.offer[3] = false;
          console.log('setfalse');
          selectMyItems.offer[4] = false;
          console.log('setfalse');
          selectMyItems.offer[5] = false;
          console.log('setfalse');
          selectMyItems.offer[6] = false;
          console.log('setfalse');
          selectMyItems.offer[7] = false;
          console.log('setfalse');
          client.packetio.sendPacket(selectMyItems);
}
But to no success, it seems like whenever I try to assign a bool to it
Heres my full source if it helps:
Code:
import { NrPlugin, HookPacket, Packet, PacketType, Client, Log } from './../core/plugin-module';
import { WorldPosData } from './../networking/data/world-pos-data';
import { NewTickPacket } from './../networking/packets/incoming/newtick-packet';
//Trade packets
import { TradeRequestedPacket } from './../networking/packets/incoming/trade-requested-packet';
import { RequestTradePacket } from './../networking/packets/outgoing/request-trade-packet';
import { TradeStartPacket } from './../networking/packets/incoming/trade-start-packet';
import { CancelTradePacket } from './../networking/packets/outgoing/cancel-trade-packet'
import { TradeChangedPacket } from './../networking/packets/incoming/trade-changed'
import { ChangeTradePacket } from './../networking/packets/outgoing/change-trade-packet'
//Text packets
import { TextPacket } from './../networking/packets/incoming/text-packet';
import { PlayerTextPacket } from './../networking/packets/outgoing/playertext-packet';
//I am going to import these from a file later.
const itemSelling = 9052;
const quantitySelling = 1;
const itemWanted = 2985;
const quantityWanted = 2;
const loop = false;
const selectMyItems = new ChangeTradePacket();
const exitTrade = new CancelTradePacket();
var mySelectedItems = 0;
const path = [
    { x: 136.5, y: 146.5 } // bottom-left
];

 @NRPlugin({
    name: 'CL TradeBot',
    author: 'Ark'
})
export default class TradeBot {
partnerQuantity: number;
partnerHasItems: boolean;

/*
//setting up messages and trades from file trades.JSON
  message: array;
  item: array;
  amnt: array;
    item[0] = 'Potion Of Life'
    item[1] = 'Potion Of Defence'
    message[0] = 'Selling ' + item[0] + 'for ' + item[1] '@' + client.playerData.name;
*/
    private players: {
        [id: number]: any[]
    };

    constructor() {
        this.players = {};
    }

    @hookPacket(PacketType.NEWTICK)
    onNewTick(client: Client, newTickPacket: NewTickPacket): void {
        if (!this.players[client.playerData.objectId]) {
            this.players[client.playerData.objectId] = path.slice();
        }
        if (!client.nextPos) {
            const wp = new WorldPosData();
            const point = this.players[client.playerData.objectId].pop();
            this.players[client.playerData.objectId].unshift(point);
            wp.x = point.x;
            wp.y = point.y;
            client.nextPos = wp;
        }
      }
    @hookPacket(PacketType.TRADEREQUESTED)
    onTradeRequested(client: Client, tradeRequestPacket: TradeRequestedPacket): void {
      console.log('New trade from: ' + tradeRequestPacket.name);
      // needs if statment
      const trade = new RequestTradePacket();
      trade.name = tradeRequestPacket.name;
      client.packetio.sendPacket(trade);
      console.log('Accepted trade request from: ' + tradeRequestPacket.name);

    }
    @hookPacket(PacketType.TRADESTART)
    onTradeStart(client: Client, tradeStartPacket: TradeStartPacket): void{
      this.partnerQuantity = 0;
      console.log('Partner Items: ')
      for(let i = 4; i < tradeStartPacket.partnerItems.length; i++){
      console.log(i-3 + ': ' + tradeStartPacket.partnerItems[i].item);
      }

      console.log('My Items: ')
      for(let i = 4; i < tradeStartPacket.clientItems.length; i++){
      console.log(i-3 + ': ' + tradeStartPacket.clientItems[i].item);
      }
      //checking the partner's inv for items
      for(let i = 4; i < tradeStartPacket.partnerItems.length; i++){
        if(tradeStartPacket.partnerItems[i].item == itemWanted){
          this.partnerQuantity++;
        }
      }

      console.log('Partner has: ' + this.partnerQuantity + 'x' + itemWanted)
      if (this.partnerQuantity >= quantityWanted){
          console.log('Partner has desired items!')
          this.partnerHasItems = true;
          mySelectedItems = 0;
          const selectMyItems = new ChangeTradePacket();
          console.log('created object selectMyItems')
          selectMyItems.offer[0] = false;
          console.log('setfalse');
          selectMyItems.offer[1] = false;
          console.log('setfalse');
          selectMyItems.offer[2] = false;
          console.log('setfalse');
          selectMyItems.offer[3] = false;
          console.log('setfalse');
          selectMyItems.offer[4] = false;
          console.log('setfalse');
          selectMyItems.offer[5] = false;
          console.log('setfalse');
          selectMyItems.offer[6] = false;
          console.log('setfalse');
          selectMyItems.offer[7] = false;
          console.log('setfalse');
          for(let m = 4; m <= tradeStartPacket.clientItems.length; m++){
            if(tradeStartPacket.clientItems[m].item == itemSelling && mySelectedItems <= quantitySelling){
              console.log('I select slot: ', m-3);
              selectMyItems.offer[m-4] = true;
              mySelectedItems++;
            }
          }
          console.log('Selecting items!')
          client.packetio.sendPacket(selectMyItems);
        }else{
          console.log('Partner is a cheap cuck who trades without items!');
          client.packetio.sendPacket(exitTrade);}
      }
  @hookPacket(PacketType.TRADECHANGED)
  onTradeChanged(client: Client, tradeChanged: TradeChangedPacket): void{
    if (this.partnerHasItems){
      console.log('Checking for partner item selection!')
    }
  }
}
The `offer` array of the ChangeTradePacket isn't allocated when you create a new packet, so you will need to manually allocate it. Its also worth noting that the `offer` array needs to have a length of 12, since it includes the items which are currently equipped (although these are always false). You can allocate the array easily using Array.fill
Code:
const changeTrade = new ChangeTradePacket();
changeTrade.offer = new Array<boolean>(12).fill(false);
// set the items you want to true
client.packetio.sendPacket(changeTrade);
If you keep getting errors in the packet hooks but don't know what they are, you can run nrelay with the `--debug` command line arg to log more information including any errors.
#2 · 8y ago
Kushala Daora
Kushala Daora
Quote Originally Posted by ArkMods View Post
Code:
          selectMyItems.offer[0] = true;
You need to start at [4] and above is true. 0-3 are the equipment slots.
[4] == slot 1
[5] == slot 2, and so on
#3 · edited 8y ago · 8y ago
ArkMods
ArkMods
Thanks for the help but I figured it out initaly when I printed the entire array to the log and there where 12 values (the first 4 containing my equipment)
#4 · 8y ago
Posts 1–4 of 4 · Page 1 of 1

Post a Reply

Similar Threads

  • Problem(with login)By 22061988 in WarRock - International Hacks
    3Last post 19y ago
  • Problem With The New Pb Hw Ban Spoofer!By naomelembro14 in WarRock - International Hacks
    5Last post 19y ago
  • Problem with trainers mades for CE, help me plsBy juanitobalde in General Game Hacking
    0Last post 19y ago
  • Problem with WarrockBy BurakG in WarRock - International Hacks
    10Last post 19y ago
  • problem with account gamefifaBy gamefifa in WarRock - International Hacks
    2Last post 19y ago

Tags for this Thread

#clientless#nodejs#rotmg