Пример #1
0
        public static bool isExclRequestStatChanged(Packet packet)
        {
            byte exclRequestSent = packet.ReadByte();
            byte unk             = packet.ReadByte();
            long statFlag        = packet.ReadLong();

            if (exclRequestSent != 0 || unk != 0 || statFlag != 0)
            {
                return(false);
            }
            return(true);
        }
Пример #2
0
        public static void handleStatChanged(Packet packet)
        {
            packet.ReadByte();
            packet.ReadByte();
            Stats type = Util.GetEnumObjectByValue <Stats>(packet.ReadLong());

            switch (type)
            {
            // ignored:
            case Stats.EVENT_POINTS:
                break;

            default:
                if (type != 0)
                {
                    Parser.getActiveScript().addComment(String.Format("Unhandled Stat Changed [{0}] Packet: {1}", type, packet.ToString()));
                }
                break;
            }
        }
Пример #3
0
        public static int parseSetField(Script script, Packet packet)
        {
            int mapID, portal;

            packet.ReadBytes(23);
            bool  bCharacterData = packet.ReadBool();
            short notifierCheck  = packet.ReadShort();

            if (notifierCheck > 0)
            {
                packet.ReadString();
                for (int i = 0; i < notifierCheck; i++)
                {
                    packet.ReadString();
                }
            }
            if (bCharacterData)
            {
                packet.ReadBytes(12);            // damage calc
                long dbFlag = packet.ReadLong(); // dbFlag
                packet.ReadByte();               //combat orders
                packet.ReadBytes(13);            // pet active skill cooltime

                int count = packet.ReadByte();
                for (int i = 0; i < count; i++)
                {
                    packet.ReadInt();
                }
                count = packet.ReadInt();
                for (int i = 0; i < count; i++)
                {
                    packet.ReadInt();
                    packet.ReadLong();
                }
                bool read = packet.ReadBool();
                if (read)
                {
                    packet.ReadByte();
                    count = packet.ReadInt();
                    for (int i = 0; i < count; i++)
                    {
                        packet.ReadLong();
                    }
                }
                packet.ReadBytes(42);
                int jobID = packet.ReadShort();
                packet.ReadBytes(26);
                if (Util.isExtendSPJob(jobID))
                {
                    int size = packet.ReadByte();
                    packet.ReadBytes(size * 5);
                }
                else
                {
                    packet.ReadShort();
                }
                packet.ReadBytes(20);
                mapID  = packet.ReadInt();
                portal = packet.ReadByte();
            }
            else
            {
                packet.ReadByte();
                mapID  = packet.ReadInt();
                portal = packet.ReadByte();
            }
            if (Parser.MAP_ID != 0 && Parser.getActiveScript().GetScriptType() != ScriptType.None)
            {
                Parser.getActiveScript().addLine(String.Format("sm.warp({0}, {1})", mapID, portal));
            }
            return(mapID);
        }
Пример #4
0
        public static void handleMessage(Packet packet)
        {
            Message type = Util.GetEnumObjectByValue <Message>(packet.ReadByte());

            switch (type)
            {
            case Message.QUEST_RECORD_EX_MESSAGE:
                int    questID = packet.ReadInt();
                String qrValue = packet.ReadString();
                switch (questID)
                {
                case 16119:
                    if (!Parser.getActiveScript().isWaitForScriptAnswer() && Parser.getActiveScript().GetScriptType() == ScriptType.MapScript)
                    {
                        Parser.dispose();
                    }
                    break;

                default:
                    Parser.getActiveScript().addComment(String.Format("Update Quest Record EX | Quest ID: [{0}] | Data: {1}", questID, qrValue));
                    break;
                }
                break;

            case Message.QUEST_RECORD_MESSAGE:
                questID = packet.ReadInt();
                int questAct = packet.ReadByte();
                if (questAct == 1)    // Start Quest
                {
                    qrValue = packet.ReadString();
                    if (qrValue.Length == 0)
                    {
                        Parser.getActiveScript().addLine(String.Format("sm.startQuest({0})", questID));
                    }
                    else
                    {
                        Parser.getActiveScript().addLine(String.Format("sm.createQuestWithQRValue({0}, {1})", questID, Util.quotes(qrValue)));
                    }
                }
                else if (questAct == 2)    // Complete Quest
                {
                    Parser.getActiveScript().addLine(String.Format("sm.completeQuest({0})", questID));
                }
                break;

            case Message.INC_EXP_MESSAGE:
                packet.ReadByte();
                Parser.getActiveScript().addLine(String.Format("sm.giveExp({0})", packet.ReadLong()));
                break;

            case Message.SYSTEM_MESSAGE:
                Parser.getActiveScript().addLine(String.Format("sm.systemMessage({0})", Util.quotes(packet.ReadString())));
                break;

            // ignored:
            //case QuestComplete:
            //    break;
            default:
                Parser.getActiveScript().addComment(String.Format("Unhandled Message [{0}] Packet: {1}", type, packet.ToString()));
                break;
            }
        }