Example #1
0
        public static COutPacket MegaphonePacket(CashItemType nType, bool bWhisperIcon, byte nChannelNo, params string[] sMsg)
        {
            var p = new COutPacket(SendOps.LP_BroadcastMsg);

            switch (nType) // idk if i like this implementation....
            {
            case CashItemType.SPEAKERCHANNEL:
                EncodeMegaphoneText(p, BroadcastMsgType.SpeakerChannel, sMsg[0]);
                break;

            case CashItemType.SPEAKERWORLD:
                EncodeMegaphoneText(p, BroadcastMsgType.SpeakerWorld, sMsg[0]);
                break;

            case CashItemType.SKULLSPEAKER:
                EncodeMegaphoneText(p, BroadcastMsgType.SkullSpeaker, sMsg[0]);
                break;

            case CashItemType.ARTSPEAKERWORLD:
                p.Encode1((byte)BroadcastMsgType.ArtSpeakerWorld);
                p.EncodeString(sMsg[0]);
                p.Encode1((byte)sMsg.Length);
                for (int i = 1; i < sMsg.Length; i++)
                {
                    p.EncodeString(sMsg[i]);
                }
                break;
            }

            p.Encode1(nChannelNo);
            p.Encode1(bWhisperIcon);

            return(p);
        }
        // =======================// ==========================================//

        public static CashItemType get_consume_cash_item_type(int nItemID)
        {
            CashItemType result = get_cashslot_item_type(nItemID);

            var resCast = (int)result;

            if (resCast < 12 || resCast > 78)
            {
                return(CashItemType.NONE);
            }

            if (resCast >= 12 && resCast <= 32)
            {
                return(result);
            }

            if (resCast >= 47 && resCast <= 54)
            {
                return(result);
            }

            if (resCast >= 71 && resCast <= 75)
            {
                return(result);
            }

            switch (result)
            {
            // 0 - 11
            // 33
            case CashItemType.CONSUMEAREABUFFITEM:
            case CashItemType.COLORLENS:
            // 36 - 37
            case CashItemType.SELECTNPC:
            // 39 - 40
            case CashItemType.MORPH:
            // 42
            case CashItemType.AVATARMEGAPHONE:
            case CashItemType.HEARTSPEAKER:
            case CashItemType.SKULLSPEAKER:
            // 46
            // 55 - 60
            case CashItemType.ARTSPEAKERWORLD:
            case CashItemType.EXTENDEXPIREDATE:
            // 63
            case CashItemType.KARMASCISSORS:
            case CashItemType.EXPIREDPROTECTING:
            case CashItemType.CHARACTERSALE:
            case CashItemType.ITEMUPGRADE:
            // 68 - 70
            // 76 - 77
            case CashItemType.QUESTDELIVERY:
                // 79+
                return(result);
            }
            return(CashItemType.NONE);
        }