Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[---------------------------------------------------------------------------
- Copyright (c) 2014, Timothy Bushey aka 'Matix'
- All rights reserved.
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- * Neither the name of Shotix nor the
- names of its contributors may be used to endorse or promote products
- derived from this software without specific prior written permission.
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL MATIX BE LIABLE FOR ANY
- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- ---------------------------------------------------------------------------]]--
- _addon.author = 'Matix';
- _addon.name = 'jchange';
- _addon.version = '0.1';
- require 'common';
- local jc_job_enum = {
- ['WAR'] = 1,
- ['MNK'] = 2,
- ['WHM'] = 3,
- ['BLM'] = 4,
- ['RDM'] = 5,
- ['THF'] = 6,
- ['PLD'] = 7,
- ['DRK'] = 8,
- ['BST'] = 9,
- ['BRD'] = 10,
- ['RNG'] = 11,
- ['SAM'] = 12,
- ['NIN'] = 13,
- ['DRG'] = 14,
- ['SMN'] = 15,
- ['BLU'] = 16,
- ['COR'] = 17,
- ['PUP'] = 18,
- ['DNC'] = 19,
- ['SCH'] = 20,
- ['GEO'] = 21,
- ['RUN'] = 22,
- }
- local function push_mjob_packet( job_id )
- local packet = { 0x100, 0x05, 0x00, 0x00, string.format('0x%X',job_id), 0x00, 0x00, 0x00 };
- AddOutgoingPacket( packet, 0x100, 8 );
- end
- local function push_sjob_packet( job_id )
- local packet = { 0x100, 0x05, 0x00, 0x00, 0x00, string.format('0x%X',job_id), 0x00, 0x00 };
- AddOutgoingPacket( packet, 0x100, 8 );
- end
- local function gen_job_packet(jobtype, jobname)
- local valid_job = false;
- for k,v in pairs(jc_job_enum) do
- if (k == string.upper(jobname)) then
- valid_job = true;
- end
- end
- if (valid_job == false) then
- return false;
- end
- if (jobtype == 1) then
- push_mjob_packet( jc_job_enum[string.upper(jobname)] )
- elseif (jobtype == 2) then
- push_sjob_packet( jc_job_enum[string.upper(jobname)] )
- end
- end
- ashita.register_event('command', function(cmd, nType)
- local args = cmd:GetArgs();
- if (args[1] == '/mjob') and (args[2]) then
- gen_job_packet(1, args[2]);
- elseif (args[1] == '/sjob') and (args[2]) then
- gen_job_packet(2, args[2]);
- end
- end );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement