Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using BattleCore;
- using BattleCore.Events;
- using BattleCorePsyOps;
- namespace zxvf
- {
- // Add the attribute and the base class
- [Behavior("MapInfo", "true", "0.01", "zxvf", "Module for testing MapData.")]
- public class TestMapInfo:BotEventListener
- {
- public TestMapInfo()
- {
- // Create a timed event at bot load - 1 second
- RegisterTimedEvent("BotLoad",1000, LoadBot);
- RegisterCommand("!minfo", getMapInfo);
- RegisterCommand("!tileid", getTileID);
- }
- ShortChat msg = new ShortChat();
- MapInfo m_MyMap;
- public void LoadBot()
- {
- // Destroy timed event so it only fires once
- RemoveTimedEvent("BotLoad");
- // ask core for bot info with mapdata attached
- Game(new BotInfoRequest());
- }
- public void getMapInfo(ChatEvent e)
- {
- string[] info = m_MyMap.MapPrintOut();
- for (int i = 0; i < info.Length; i += 1)
- {
- Game(msg.arena(info[i]));
- }
- }
- public void getTileID(ChatEvent e)
- {
- string[] Data = e.Message.Split(' ');
- int x, y;
- if (Int32.TryParse(Data[1],out x) && (Int32.TryParse(Data[2],out y)))
- Game(msg.pm(e.PlayerName, "Tile ID for [" + x + "][" + y + "] is: [" + m_MyMap.GetTileID((ushort)x, (ushort)y) + "]."));
- else
- Game(msg.pm(e.PlayerName,"Error parsing info."));
- }
- // Grab the incoming event per your request just above this line
- public void MonitorIncomingBotInfo(object sender, BotInfoRequest e)
- {
- m_MyMap = new MapInfo(e.MapData);
- // Grab botname and mapdata here
- Game(msg.arena("BotName[ " + e.BotName + " ] Level Name [ "+e.MapFile+" ] MapInfoLength[ " + e.MapData.Length + " ]"));
- }
- public override void Dispose()
- {
- throw new NotImplementedException();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment