All pastes #966990 Raw Edit

HyDro

public text v1 · immutable
·published 2008-04-02 03:25 UTC
rendered paste body
        case PacketID.R_Chat_0:
                                {
                                    ushort len = ProcessBuf.ReadShort();
                                    string msg = ProcessBuf.ReadString(len);

                                    BufferClass.Buffer Response = new BufferClass.Buffer((uint)len + 4);
                                    Response.WriteShort((ushort)PacketID.S_Chat_0);
                                    Response.WriteInt(1);
                                    Response.WriteByte(00);
                                    Response.WriteShort(len);
                                    Response.WriteString(msg);
                                    SendEncrypted(RIV, Response.GetWrittenBuffer(), nClient);
                                    MapleCrypto.GenerateIV(RIV);

                                    string ReceivedMessage = ProcessBuf.ReadStringFromLength();
                                    Console.WriteLine("Received Message: " + ReceivedMessage);
                                    if (ReceivedMessage.Length > 7)
                                    {
                                        if (ReceivedMessage.Remove(7) == "!notice")
                                        {
                                            string TheNotice = ReceivedMessage.Remove(0, 8);
                                            byte[] aResponse = Processor.SendBlueGMNotice(TheNotice);
                                            SendEncrypted(RIV, aResponse, nClient);
                                            MapleCrypto.GenerateIV(RIV);
                                        }
                                        else if (ReceivedMessage.Remove(7) == "!summon")
                                        {
                                            int TheMonsterID = Convert.ToInt32(ReceivedMessage.Remove(0, 8));
                                            spawnedmonster = spawnedmonster + 1;
                                            byte[] aResponse = Processor.SpawnRealMonster(TheMonsterID, spawnedmonster, (ushort)UserX, (ushort)UserY);
                                            SendEncrypted(RIV, aResponse, nClient);
                                            MapleCrypto.GenerateIV(RIV);
                                        }
                                        else if (ReceivedMessage.Remove(7) == "!unreal")
                                        {
                                            int TheMonsterID = Convert.ToInt32(ReceivedMessage.Remove(0, 8));
                                            spawnedmonster = spawnedmonster + 1;
                                            byte[] aResponse = Processor.SpawnFakeMonster(TheMonsterID, spawnedmonster, (ushort)UserX, (ushort)UserY);
                                            SendEncrypted(RIV, aResponse, nClient);
                                            MapleCrypto.GenerateIV(RIV);
                                        }

                                        break;
                                    }

                                }