+ Reply to Thread
Results 1 to 1 of 1
Like Tree1Likes
  • 1 Post By Bamul

Thread: EQDKP generates a Rift invite macro and invite your raid member with one click

  1. #1
    Plane Walker
    Join Date
    Sep 2010
    Posts
    449

    Default EQDKP generates a Rift invite macro and invite your raid member with one click

    With this EQDKP plugin you can create a Rift invite macro and invite your raid members from different servers with one click.

    As an an example you get the following macro from the EQDKP System:

    /i Raidmember01@Server
    /i Raidmember02@Server
    /i Raidmember03@Server
    ...
    ...
    ...
    /i Raidmember20@Server

    First you need to create a profile field for the server !

    EQDKP Administration Panel > Characters > Profile fields Management

    ID: server
    Name: Server
    Type: Dropdown
    Category: Charakter
    Field length: 3

    Dropdown options:
    ID: S0 Name: Servername1
    ID: S1 Name: Servername2
    ...
    ...
    ...
    ID: SX Name: ServernameX


    Next, create a file named invite.class.php

    Copy the following code and paste it into the file invite.class.php
    Code:
    <?php
    /*	Project:	EQdkp-Plus
     *	Package:	EQdkp-plus
     *	Link:		http://eqdkp-plus.eu
     *
     *	Copyright (C) 2006-2015 EQdkp-Plus Developer Team
     *
     *	This program is free software: you can redistribute it and/or modify
     *	it under the terms of the GNU Affero General Public License as published
     *	by the Free Software Foundation, either version 3 of the License, or
     *	(at your option) any later version.
     *
     *	This program is distributed in the hope that it will be useful,
     *	but WITHOUT ANY WARRANTY; without even the implied warranty of
     *	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     *	GNU Affero General Public License for more details.
     *
     *	You should have received a copy of the GNU Affero General Public License
     *	along with this program.  If not, see <http://www.gnu.org/licenses/>.
     */
    
    if ( !defined('EQDKP_INC') ){
    	header('HTTP/1.0 404 Not Found');exit;
    }
    
    $rpexport_plugin['invite.class.php'] = array(
    	'name'			=> 'Invite',
    	'function'		=> 'INVexport',
    	'contact'		=> 'bamux@typhiria.de',
    	'version'		=> '1.0.0');
    
    if(!function_exists('INVexport')){
    	function INVexport($raid_id, $raid_groups){
    		$attendees	= registry::register('plus_datahandler')->get('calendar_raids_attendees', 'attendees', array($raid_id));
    		$guests		= registry::register('plus_datahandler')->get('calendar_raids_guests', 'members', array($raid_id));
    
    		$a_json	= array();
    		foreach($attendees as $id_attendees=>$d_attendees){
    			$a_json[]	= array(
    				'name'		=> registry::register('plus_datahandler')->get('member', 'name', array($id_attendees)),
    				'status'	=> $d_attendees['signup_status'],
    				'guest'		=> false,
    				'group'		=> $d_attendees['raidgroup'],
    				'server'	=> registry::register('plus_datahandler')->get('member', 'html_profile_field', array($id_attendees, 'server'))
    			);
    		}
    		foreach($guests as $guestsdata){
    			$a_json[]	= array(
    				'name'		=> $guestsdata['name'],
    				'status'	=> false,
    				'guest'		=> true,
    				'group'		=> $guestsdata['raidgroup'],
    				'server'	=> ''
    			);
    		}
    		$json = json_encode($a_json);
    		unset($a_json);
    
    		registry::register('template')->add_js('
    			genOutput()
    			$("input[type=\'checkbox\'], #ip_seperator, #raidgroup").change(function (){
    				genOutput()
    			});
    			
    		', "docready");
    
    		registry::register('template')->add_js('
    		function genOutput(){
    			var attendee_data = '.$json.';
    			var data = [];
    
    			ip_seperator	= ($("#ip_seperator").val() != "") ? $("#ip_seperator").val() : "/i ";
    			cb_guests		= ($("#cb_guests").attr("checked")) ? true : false;
    			cb_confirmed	= ($("#cb_confirmed").attr("checked")) ? true : false;
    			cb_signedin		= ($("#cb_signedin").attr("checked")) ? true : false;
    			cb_backup		= ($("#cb_backup").attr("checked")) ? true : false;
    
    			$.each(attendee_data, function(i, item) {
    				if((cb_guests && item.guest == true) || (cb_confirmed && !item.guest && item.status == 0) || (cb_signedin && item.status == 1) || (cb_backup && item.status == 3)){
    					if($("#raidgroup").val() == "0" || (item.group > 0 && item.group == $("#raidgroup").val())){
    						data.push(item.name + ((item.server == "") ? "" : "@" + item.server));
    					}
    				}
    			});
    			$("#attendeeout").html(ip_seperator + data.join("\n"+ip_seperator));
    		}
    			');
    		$text  = "<dt><label>".registry::fetch('user')->lang('raidevent_export_seperator')."</label></dt>
    					<dd>
    						<input type='text' name='seperator' id='ip_seperator' value='/i ' size='4' />
    					</dd>
    				</dl><dl>";
    		
    		$text .= "<dt><label>".registry::fetch('user')->lang('raidevent_export_raidgroup')."</label></dt>
    					<dd>
    						".new hdropdown('raidgroup', array('options' => $raid_groups, 'value' => 0, 'id' => 'raidgroup'))."
    					</dd>
    				</dl><dl>";
    		$text .= "<input type='checkbox' checked='checked' name='confirmed' id='cb_confirmed' value='true'> ".registry::fetch('user')->lang(array('raidevent_raid_status', 0));
    		$text .= "<input type='checkbox' checked='checked' name='guests' id='cb_guests' value='true'> ".registry::fetch('user')->lang('raidevent_raid_guests');
    		$text .= "<input type='checkbox' checked='checked' name='signedin' id='cb_signedin' value='true'> ".registry::fetch('user')->lang(array('raidevent_raid_status', 1));
    		$text .= "<input type='checkbox' name='backup' id='cb_backup' value='true'> ".registry::fetch('user')->lang(array('raidevent_raid_status', 3));
    		$text .= "<br/>";
    		$text .= "<textarea name='group".rand()."' id='attendeeout' cols='60' rows='10' onfocus='this.select()' readonly='readonly'>";
    		$text .= "</textarea>";
    
    		$text .= '<br/>'.registry::fetch('user')->lang('rp_copypaste_ig')."</b>";
    		return $text;
    	}
    }
    ?>
    Add this file to /core/calendarexport in your EQDKP directory.

    How to create a invite Macro ?
    1. Open any Raid in your Raid Calendar.
    2. Click on Settings > Export raid data
    3. Select export module: invite
    4. copy and paste the text and create in Rift your invite macro

+ Reply to Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts