Exemplo n.º 1
0
        private void OnGotCommand(object sender, TCPWrapper.GotCommandEventArgs e)
        {
            //if (TheTradeHandler.makingDeposit)
            //{
            //    if (e.CommandBuffer[0] == 68) // STORAGE_ITEMS (per category)
            //    {
            //        STORAGE_ITEMS(e.CommandBuffer);
            //    }
            //}
            if (TheTradeHandler.depositMade)
            {
                if (e.CommandBuffer[0] == 68) // STORAGE_ITEMS (per category)
                {
                    STORAGE_ITEMS(e.CommandBuffer);
                }
                if (e.CommandBuffer[0] == 21)
                {
                    GET_NEW_INVENTORY_ITEM(e.CommandBuffer);
                }

                if (e.CommandBuffer[0] == 49)
                {
                    SEND_PARTIAL_STAT(e.CommandBuffer);
                }
            }
        }
Exemplo n.º 2
0
 private void OnGotCommand(object sender, TCPWrapper.GotCommandEventArgs e)
 {
     if (e.CommandBuffer[0] == 0x05 && BasicCommunication.new_minute.getServerTime() != new DateTime()) //new minute
     {
         //will want to check the number of elapsed minutes and see if we need to advertise
     }
 }
Exemplo n.º 3
0
 private void OnGotCommand(object sender, TCPWrapper.GotCommandEventArgs e)
 {
     if (e.CommandBuffer[0] == 0x3c)
     {
         SendPing(e.CommandBuffer);
     }
 }
Exemplo n.º 4
0
 private void OnGotCommand(object sender, TCPWrapper.GotCommandEventArgs e)
 {
     if (e.CommandBuffer[0] == 0x00)
     {
         RxRAW_TEXT(e.CommandBuffer);
     }
 }
Exemplo n.º 5
0
 private void OnGotCommand(object sender, TCPWrapper.GotCommandEventArgs e)
 {
     if (e.CommandBuffer[0] == 59)
     {
         string name      = System.Text.ASCIIEncoding.ASCII.GetString(e.CommandBuffer, 5, e.CommandBuffer.Length - 6);
         int    colorCode = e.CommandBuffer[4];
         if (colorCode == 254)
         {
             //logged off
             TheMySqlManager.setBuddyOffline(name);
             if (!firstTimeThrough)
             {
                 string tempText = "#gm " + System.Convert.ToChar(TheMySqlManager.playerloggedoffcolor(Settings.botid)) + "### " + name.ToUpper() + " LOGGED OFF ###";
                 TheTCPWrapper.Send(CommandCreator.RAW_TEXT(tempText));
             }
         }
         else if (colorCode == 0)
         {
             //logged on
             TheMySqlManager.setBuddyOnline(name);
             if (!firstTimeThrough)
             {
                 string tempText = "#gm " + System.Convert.ToChar(TheMySqlManager.playerloggedoncolor(Settings.botid)) + "### " + name.ToUpper() + " LOGGED ON ###";
                 TheTCPWrapper.Send(CommandCreator.RAW_TEXT(tempText));
             }
         }
         else
         {
             name = System.Text.ASCIIEncoding.ASCII.GetString(e.CommandBuffer, 4, e.CommandBuffer.Length - 4);
             TheMySqlManager.deleteBuddy(name);
         }
     }
 }
Exemplo n.º 6
0
 private void OnGotCommand(object sender, TCPWrapper.GotCommandEventArgs e)
 {
     if (e.CommandBuffer[0] == 0x00 && usingItem)  //this means raw text
     {
         string MessageBuffer = System.Text.ASCIIEncoding.ASCII.GetString(e.CommandBuffer, 5, e.CommandBuffer.Length - 5);
         if (MessageBuffer.Contains("this item still has"))
         {
             cooldownMessage = MessageBuffer;
         }
     }
 }
Exemplo n.º 7
0
 private void OnGotCommand(object sender, TCPWrapper.GotCommandEventArgs e)
 {
     if (e.CommandBuffer[0] == 0x07) //CHANGE_MAP
     {
         MainClass.mapName = System.Text.ASCIIEncoding.ASCII.GetString(e.CommandBuffer, 5, e.CommandBuffer.Length - 6);
         if (!AdvancedCommunication.GotoCommandHandler.gettingLocationInfo)
         {
             AdvancedCommunication.GotoCommandHandler.gettingLocationInfo = true;
             TheTCPWrapper.Send(CommandCreator.LOCATE_ME());
         }
     }
 }
Exemplo n.º 8
0
        private void OnGotRXData(object sender, TCPWrapper.GotCommandEventArgs e)
        {
            if (RxDebug == false)
            {
                return;
            }

            string CmdString = ConvertByteCommandToString_ToClient(e.CommandBuffer[0]);
//            if (e.CommandBuffer[0] != 47 && e.CommandBuffer[0] != 69)
            {
                TheLogger.Log("Received Command:" + CmdString + " Bytes: " + e.CommandBuffer.Length.ToString());
            }
        }
Exemplo n.º 9
0
 private void OnGotCommand(object sender, TCPWrapper.GotCommandEventArgs e)
 {
     if (e.CommandBuffer[0] == 250)
     {
         OnGot_LOG_IN_OK(new EventArgs());
         return;
     }
     if (e.CommandBuffer[0] == 251)
     {
         OnGot_LOG_IN_NOT_OK(new EventArgs());
         return;
     }
 }
Exemplo n.º 10
0
        private void OnGotCommand(object sender, TCPWrapper.GotCommandEventArgs e)
        {
            byte[] buffer = e.CommandBuffer;
            byte   cmd    = e.CommandBuffer[0];

            switch (cmd)
            {
            //ADD_NEW_ACTOR (NPC)
            case 0x01:
                ADD_NEW_ACTOR(buffer);
                break;

            //ADD_ACTOR_COMMAND
            case 0x02:
                ADD_ACTOR_COMMAND(buffer);
                break;

            //ADD_NEW_ENHANCED_ACTOR
            case 0x33:
                ADD_NEW_ENHANCED_ACTOR(buffer);
                break;

            //REMOVE_ACTOR
            case 0x06:
                REMOVE_ACTOR(buffer);
                break;

            //YOU_ARE
            case 0x03:
                //user_id = System.BitConverter.ToInt16(buffer,3);
                YOU_ARE(buffer);
                break;

            //KILL_ALL_ACTORS
            case 0x09:
                KILL_ALL_ACTORS(buffer);
                break;

            //SEND_BUFFS
            case 78:
                UPDATE_BUFFS(buffer);
                break;
            }
        }
Exemplo n.º 11
0
 private void OnGotCommand(object sender, TCPWrapper.GotCommandEventArgs e)
 {
     if (MainClass.tryingToConnect)
     {
         return;
     }
     if (e.CommandBuffer[0] == 0x05) //new minute
     {
         if (serverTime == new DateTime())
         {
             TheTCPWrapper.Send(CommandCreator.SYNC_CLOCK());
         }
         else
         {
             serverTime = serverTime.AddMinutes(1);
         }
         do_new_minute(e.CommandBuffer);
     }
     if (e.CommandBuffer[0] == 0x00 && e.CommandBuffer[4] == 130)  //this means raw text
     {
         string MessageBuffer = System.Text.ASCIIEncoding.ASCII.GetString(e.CommandBuffer, 5, e.CommandBuffer.Length - 5);
         if (MessageBuffer.Contains("Game Time"))
         {
             string [] messageArray   = MessageBuffer.Split(':');
             string    dateTimeString = "";
             for (int i = 1; i < messageArray.Length; i++)
             {
                 if (i < messageArray.Length - 1)
                 {
                     dateTimeString += messageArray[i];
                     dateTimeString += ":";
                 }
                 else
                 {
                     dateTimeString += "00";
                     break;
                 }
             }
             serverTime = Convert.ToDateTime(dateTimeString);
         }
     }
 }
Exemplo n.º 12
0
        private void OnGotCommand(object sender, TCPWrapper.GotCommandEventArgs e)
        {
            if (!claimingPrize)
            {
                return;
            }

            if (e.CommandBuffer[0] == 41) //GET_TRADE_PARTNER_name
            {
                GET_TRADE_PARTNER(e.CommandBuffer);
                return;
            }

            if (e.CommandBuffer[0] == 35) // GET_TRADE_OBJECT
            {
                GET_TRADE_OBJECT(e.CommandBuffer);
                //they shouldn't be putting stuff in the window, just accepting...
                //TheTCPWrapper.Send(CommandCreator.EXIT_TRADE());
                return;
            }

            if (e.CommandBuffer[0] == 37) //if they un-accept, for some reason...
            {
                GET_TRADE_REJECT(e.CommandBuffer);
                return;
            }

            if (e.CommandBuffer[0] == 36)
            {
                GET_TRADE_ACCEPT(e.CommandBuffer);
                return;
            }

            if (e.CommandBuffer[0] == 39)
            {
                //it should never get here, if they put something in the window we're going to cancel the prize claim anyways
                return;
            }
        }
Exemplo n.º 13
0
        private void OnGotCommand(object sender, TCPWrapper.GotCommandEventArgs e)
        {
            if (TheTradeHandler.claimingPrize)
            {
                return;
            }
            if (!TheTradeHandler.Gambling)
            {
                return;
            }
            if (e.CommandBuffer[0] == 35) // GET_TRADE_OBJECT
            {
                GET_TRADE_OBJECT(e.CommandBuffer);
                return;
            }

            if (e.CommandBuffer[0] == 37)
            {
                GET_TRADE_REJECT(e.CommandBuffer);
                return;
            }

            if (e.CommandBuffer[0] == 36)
            {
                GET_TRADE_ACCEPT(e.CommandBuffer);
                return;
            }

            if (e.CommandBuffer[0] == 38)
            {
                GET_TRADE_ABORT(e.CommandBuffer);
                return;
            }
            if (e.CommandBuffer[0] == 39)
            {
                REMOVE_TRADE_OBJECT(e.CommandBuffer);
                return;
            }
        }
Exemplo n.º 14
0
        private void OnGotCommand(object sender, TCPWrapper.GotCommandEventArgs e)
        {
            if (wearAction == "")
            {
                return;
            }
            if (e.CommandBuffer[0] == 52 || e.CommandBuffer[0] == 53) // ACTOR_WEAR_ITEM||UNWEAR
            {
                Int16 actorId = System.BitConverter.ToInt16(e.CommandBuffer, 3);
                //byte pos = e.CommandBuffer[6];
                if (actorId == TheActorHandler.MyActorID && TheInventory.GettingInventoryItems == false)
                {
                    TradeHandler.TradeLogItem MyTradeLogItem;
                    MyTradeLogItem.action          = wearAction;
                    MyTradeLogItem.quantity        = 1;
                    MyTradeLogItem.price           = 0;
                    MyTradeLogItem.KnownItemsSqlID = SQLID;
                    MyTradeLogItem.categoryNum     = -1;
                    this.TheMySqlManager.LogTrade(MyTradeLogItem, username, Settings.botid, true);
                    wearAction = "";
                }
            }
            if (e.CommandBuffer[0] == 20)
            {
                string Text = System.Text.ASCIIEncoding.ASCII.GetString(e.CommandBuffer, 4, e.CommandBuffer.Length - 4).Trim();
                Text = Text.Replace((char)10, ' ');
                TheLogger.Log(Text);
                TheTCPWrapper.Send(CommandCreator.SEND_PM(username, "I can't wear that item!"));
                wearAction = "";
            }

            if (e.CommandBuffer[0] == 21 && (wearAction != "")) // GET_INVENTORY_ITEM
            {
                TheInventory.requestInventory();
            }
        }