Location: PHPKode > projects > OTWG - Online Turn based War Game > otwg/plugin.php
<?php
/*  Copyright 2006, Robert Widell, KodApa & the OTWG project @ Sourceforge
	See http://sourceforge.net/projects/otwg/ for the latest news

	This file is part of OTWG.

    OTWG is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    OTWG 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 General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with OTWG; if not, write to the Free Software
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA */
		
/*	Do NOT make changes to this file unless you are positively sure
	you know what you are doing */
	
if (!defined('e107_INIT')) { exit; }

// Plugin info -------------------------------------------------------------------------------------------------------
$eplug_name = "OTWG";
$eplug_version = "0.1.3";
$eplug_author = "OTWG project @ Sourceforge";
$eplug_url = "http://otwg_hq.kodapa.com";
$eplug_email = "hide@address.com";
$eplug_description = "This is the Online Turnbased Wargame (OTWG). Enjoy!";
$eplug_compatible = "e107 v0.7.8";
$eplug_readme = "";

// Name of the plugin's folder -------------------------------------------------------------------------------------
$eplug_folder = "otwg";

// Name of menu item for plugin ----------------------------------------------------------------------------------
$eplug_menu_name = "otwg_menu";

// Name of the admin configuration file --------------------------------------------------------------------------
$eplug_conffile = "admin_main.php";

// Icon image and caption text ------------------------------------------------------------------------------------
$eplug_icon = $eplug_folder."/resources/otwg_logo_32.png";
$eplug_icon_small = $eplug_folder."/resources/otwg_logo_16.png";
$eplug_caption = "OTWG version ".$eplug_version;

// List of preferences -----------------------------------------------------------------------------------------------
$eplug_prefs = "";

// List of table names -----------------------------------------------------------------------------------------------
$eplug_table_names = array("otwg_equipment","otwg_equipment_type","otwg_leader_status","otwg_leaders","otwg_map","otwg_map_hex","otwg_mission","otwg_nationality","otwg_rank","otwg_scenario","otwg_scenarios_sides","otwg_side","otwg_unit","otwg_unit_equipment","otwg_unit_status","otwg_unit_subtype","otwg_unit_type","otwg_version");

// List of sql requests to create tables  and add data-----------------------------------------------------------------------------
$eplug_tables = array(
"CREATE TABLE ".MPREFIX."otwg_equipment (
  ID int(11) NOT NULL auto_increment,
  Name varchar(50) NOT NULL default '',
  Range int(11) NOT NULL default '0',
  Accuracy int(11) NOT NULL default '0',
  Effect int(11) NOT NULL default '0',
  Max_Altitude int(11) NOT NULL default '0',
  Min_Altitude int(11) NOT NULL default '0',
  Armor int(11) NOT NULL default '0',
  Penetration int(11) NOT NULL default '0',
  Probability int(11) NOT NULL default '0',
  Anti_Armor int(11) NOT NULL default '0',
  Anti_Ship int(11) NOT NULL default '0',
  Anti_Soft int(11) NOT NULL default '0',
  Anti_Sub int(11) NOT NULL default '0',
  Anti_Building int(11) NOT NULL default '0',
  Bombardment set('No','Yes') NOT NULL default 'No',
  Defense_Factor int(11) NOT NULL default '0',
  Weight int(11) NOT NULL default '0',
  Available_From int(11) NOT NULL default '0',
  Available_To int(11) NOT NULL default '0',
  Equipment_Nationality_ID int(11) NOT NULL default '1',
  Equipment_Type_ID int(11) NOT NULL default '0',
  Equipment_SubType_ID int(11) NOT NULL default '1',
  Engineering int(11) NOT NULL default '0',
  Fording int(11) NOT NULL default '0',
  Facility_Repair int(11) NOT NULL default '0',
  Supply_Need int(11) NOT NULL default '0',
  Combat_Supply_Factor int(11) NOT NULL default '0',
  Fuel_Consumption int(11) NOT NULL default '0',
  NBC int(11) NOT NULL default '0',
  Recon int(11) NOT NULL default '0',
  Transport_Cabability int(11) NOT NULL default '0',
  Image_ID int(11) NOT NULL default '0',
  All_Weather_Capability int(11) NOT NULL default '0',
  Night_Capability int(11) NOT NULL default '0',
  Size int(11) NOT NULL default '0',
  PRIMARY KEY  (ID)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=6;",
"INSERT INTO ".MPREFIX."otwg_equipment (`ID`, `Name`, `Range`, `Accuracy`, `Effect`, `Max_Altitude`, `Min_Altitude`, `Armor`, `Penetration`, `Probability`, `Anti_Armor`, `Anti_Ship`, `Anti_Soft`, `Anti_Sub`, `Anti_Building`, `Bombardment`, `Defense_Factor`, `Weight`, `Available_From`, `Available_To`, `Equipment_Nationality_ID`, `Equipment_Type_ID`, `Equipment_SubType_ID`, `Engineering`, `Fording`, `Facility_Repair`, `Supply_Need`, `Combat_Supply_Factor`, `Fuel_Consumption`, `NBC`, `Recon`, `Transport_Cabability`, `Image_ID`, `All_Weather_Capability`, `Night_Capability`, `Size`) VALUES 
(1, 'Platoon HQ', 0, 1, 0, 0, 0, 0, 1, 100, 1, 0, 25, 0, 0, 'No', 2, 3000, 1939, 1945, 1, 1, 2, 0, 0, 0, 50, 2, 0, 0, 1, 0, 0, 75, 75, 15),
(2, 'Rifle Squad', 1, 0, 0, 0, 0, 0, 5, 100, 5, 0, 50, 0, 5, 'No', 2, 4000, 1939, 1945, 1, 1, 1, 0, 0, 0, 100, 2, 0, 0, 2, 0, 0, 50, 75, 10),
(3, 'Mortar Squad', 2, 0, 0, 0, 0, 0, 10, 90, 10, 0, 75, 0, 10, 'Yes', 2, 3000, 1939, 1945, 1, 1, 1, 0, 0, 0, 80, 3, 0, 0, 1, 0, 0, 30, 50, 7),
(4, 'Light Tank', 2, 1, 0, 0, 0, 5, 40, 80, 50, 0, 90, 0, 25, 'No', 1, 20000, 1939, 1945, 1, 1, 1, 0, 0, 0, 100, 5, 100, 0, 1, 0, 0, 10, 25, 15),
(5, 'Recon Squad', 0, 1, 0, 0, 0, 0, 1, 100, 1, 0, 35, 0, 0, 'No', 1, 2000, 1939, 1945, 1, 1, 1, 0, 0, 0, 80, 2, 0, 0, 5, 0, 0, 75, 80, 7);",
"CREATE TABLE ".MPREFIX."otwg_equipment_type (
  ID int(11) NOT NULL auto_increment,
  Name varchar(20) NOT NULL default 'Ground',
  PRIMARY KEY  (ID)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=2;",
"INSERT INTO ".MPREFIX."otwg_equipment_type (`ID`, `Name`) VALUES 
(1, 'Ground');",
"CREATE TABLE ".MPREFIX."otwg_leader_status (
  ID int(11) NOT NULL auto_increment,
  Name varchar(15) NOT NULL default 'OK',
  PRIMARY KEY  (ID)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=4;",
"INSERT INTO ".MPREFIX."otwg_leader_status (`ID`, `Name`) VALUES 
(1, 'OK'),
(2, 'MIA'),
(3, 'KIA');",
"CREATE TABLE ".MPREFIX."otwg_leaders (
  ID int(11) NOT NULL auto_increment,
  Name varchar(50) NOT NULL default '',
  Rank_ID int(11) NOT NULL default '0',
  User_ID int(11) NOT NULL default '0',
  Leadership int(11) NOT NULL default '0',
  Inspiration int(11) NOT NULL default '0',
  Experience int(11) NOT NULL default '0',
  Morale int(11) NOT NULL default '0',
  Administration int(11) NOT NULL default '0',
  Naval int(11) NOT NULL default '0',
  Air int(11) NOT NULL default '0',
  Ground int(11) NOT NULL default '0',
  Aggresivness int(11) NOT NULL default '0',
  Unit_ID int(11) NOT NULL default '0',
  CINC_ID int(11) NOT NULL default '0',
  Image_ID int(11) NOT NULL default '0',
  Nation_ID int(11) NOT NULL default '0',
  Side_ID int(11) NOT NULL default '0',
  Status_ID int(11) NOT NULL default '0',
  Title varchar(50) NOT NULL default '',
  Activates int(11) NOT NULL default '0',
  PRIMARY KEY  (ID)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=3;",
"INSERT INTO ".MPREFIX."otwg_leaders (`ID`, `Name`, `Rank_ID`, `User_ID`, `Leadership`, `Inspiration`, `Experience`, `Morale`, `Administration`, `Naval`, `Air`, `Ground`, `Aggresivness`, `Unit_ID`, `CINC_ID`, `Image_ID`, `Nation_ID`, `Side_ID`, `Status_ID`, `Title`, `Activates`) VALUES 
(1, 'Red Leader', 1, 0, 0, 0, 50, 100, 0, 0, 0, 0, 75, 1, 0, 0, 1, 2, 1, '', 0),
(2, 'Blue Leader', 1, 0, 0, 0, 50, 100, 0, 0, 0, 0, 75, 2, 0, 0, 1, 1, 1, '', 0);",
"CREATE TABLE ".MPREFIX."otwg_map (
  ID int(11) NOT NULL auto_increment,
  Name varchar(25) NOT NULL default '',
  Hex_Size int(11) NOT NULL default '5',
  Image_ID varchar(25) NOT NULL default 'scenario_1',
  PRIMARY KEY  (ID)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=2;",
"INSERT INTO ".MPREFIX."otwg_map (`ID`, `Name`, `Hex_Size`, `Image_ID`) VALUES 
(1, 'Scenario 1 Map', 5, 'scenario_1');",
"CREATE TABLE ".MPREFIX."otwg_map_hex (
  ID int(11) NOT NULL auto_increment,
  map_ID int(11) NOT NULL default '0',
  CCV_Check set('yes','no') NOT NULL default 'no',
  CPT_Value int(11) NOT NULL default '0',
  PRIMARY KEY  (ID)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=3;",
"INSERT INTO ".MPREFIX."otwg_map_hex (`ID`, `map_ID`, `CCV_Check`, `CPT_Value`) VALUES 
(1, 1, 'yes', 0),
(2, 1, 'no', 0);",
"CREATE TABLE ".MPREFIX."otwg_mission (
  ID int(11) NOT NULL auto_increment,
  Name varchar(20) NOT NULL default '',
  MCV int(11) NOT NULL default '25',
  MIF int(11) NOT NULL default '1',
  PRIMARY KEY  (ID)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=3;",
"INSERT INTO ".MPREFIX."otwg_mission (`ID`, `Name`, `MCV`, `MIF`) VALUES 
(1, 'No Orders', 10, 1),
(2, 'Attack', 100, 10);",
"CREATE TABLE ".MPREFIX."otwg_nationality (
  ID int(11) NOT NULL auto_increment,
  Name varchar(50) NOT NULL default '',
  PRIMARY KEY  (ID)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=2;",
"INSERT INTO ".MPREFIX."otwg_nationality (`ID`, `Name`) VALUES 
(1, 'Generic');",
"CREATE TABLE ".MPREFIX."otwg_rank (
  ID int(11) NOT NULL auto_increment,
  Name varchar(50) NOT NULL default '',
  Command_Capacity int(11) NOT NULL default '0',
  Image_ID int(11) NOT NULL default '0',
  Side_ID int(11) NOT NULL default '0',
  Level int(11) NOT NULL default '0',
  PRIMARY KEY  (ID)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;",
"CREATE TABLE ".MPREFIX."otwg_scenario (
  ID int(11) NOT NULL auto_increment,
  Name varchar(100) NOT NULL default '',
  Starts date NOT NULL default '0000-00-00',
  Ends date default NULL,
  Image_ID varchar(50) NOT NULL default '0',
  Map_ID int(11) NOT NULL default '0',
  Hour_per_Cycle int(11) NOT NULL default '1',
  Curr_D date NOT NULL default '0000-00-00',
  Briefing_General longtext NOT NULL,
  Description longtext NOT NULL,
  Version varchar(20) NOT NULL default '',
  Status varchar(50) NOT NULL default '',
  Author varchar(100) NOT NULL default '',
  Active set('Yes','No') NOT NULL default 'No',
  PRIMARY KEY  (ID),
  FULLTEXT KEY Briefing_General (Briefing_General,Description,Author)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=33;",
"INSERT INTO ".MPREFIX."otwg_scenario (`ID`, `Name`, `Starts`, `Ends`, `Image_ID`, `Map_ID`, `Hour_per_Cycle`, `Curr_D`, `Briefing_General`, `Description`, `Version`, `Status`, `Author`, `Active`) VALUES 
(1, 'HARM testing', '1942-02-02', '1942-02-03', 'scenario_1.png', 1, 1, '1942-02-02', 'Testing the HARM resolution algorithms', 'Just for testing', '0.0.1', 'New', 'R.Widell', 'Yes');",
"CREATE TABLE ".MPREFIX."otwg_scenarios_sides (
  ID int(11) NOT NULL auto_increment,
  Scenario_ID int(11) NOT NULL default '0',
  Side_ID int(11) NOT NULL default '0',
  Briefing_Side longtext NOT NULL,
  PRIMARY KEY  (ID),
  FULLTEXT KEY Briefing_Side (Briefing_Side)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=3;",
"INSERT INTO ".MPREFIX."otwg_scenarios_sides (`ID`, `Scenario_ID`, `Side_ID`, `Briefing_Side`) VALUES 
(1, 1, 1, 'The Blue Commander in Chief has the mission to destroy all Red units in the theatre\r\n\r\nLorem Ipsum.....'),
(2, 1, 2, 'The mission for the Red Commander in Chief is to destroy all Blue forces on the map\r\n\r\nLorem Ipsum...');",
"CREATE TABLE ".MPREFIX."otwg_side (
  ID int(11) NOT NULL auto_increment,
  Name varchar(50) NOT NULL default '',
  Image_ID int(11) NOT NULL default '0',
  Nation_ID int(11) NOT NULL default '0',
  PRIMARY KEY  (ID)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=3;",
"INSERT INTO ".MPREFIX."otwg_side (`ID`, `Name`, `Image_ID`, `Nation_ID`) VALUES 
(1, 'Blue Side', 0, 1),
(2, 'Red Side', 0, 1);",
"CREATE TABLE ".MPREFIX."otwg_unit (
  ID int(11) NOT NULL auto_increment,
  Name varchar(50) NOT NULL default '',
  Leader_ID int(11) NOT NULL default '0',
  Experience int(11) NOT NULL default '0',
  Morale int(11) NOT NULL default '0',
  Readiness int(11) NOT NULL default '0',
  Unit_Type_ID int(11) NOT NULL default '0',
  Unit_SubType_ID int(11) NOT NULL default '0',
  Image_ID varchar(50) NOT NULL default '0',
  Reports_To_ID int(11) NOT NULL default '0',
  Loc_Z int(11) NOT NULL default '0',
  Status_ID int(11) NOT NULL default '0',
  IVP_multiplier int(11) NOT NULL default '1',
  Arrival int(11) NOT NULL default '0',
  Withdrawal int(11) NOT NULL default '0',
  Reinforce set('Yes','No') NOT NULL default 'Yes',
  Upgrade set('Yes','No') NOT NULL default 'Yes',
  Map_Hex_ID int(11) NOT NULL default '0',
  Side_ID int(11) NOT NULL default '0',
  Loc_X int(11) NOT NULL default '0',
  Loc_Y int(11) NOT NULL default '0',
  Mission_ID int(11) NOT NULL default '1',
  Scenario_ID int(11) NOT NULL default '0',
  PRIMARY KEY  (ID)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=3;",
"INSERT INTO ".MPREFIX."otwg_unit (`ID`, `Name`, `Leader_ID`, `Experience`, `Morale`, `Readiness`, `Unit_Type_ID`, `Unit_SubType_ID`, `Image_ID`, `Reports_To_ID`, `Loc_Z`, `Status_ID`, `IVP_multiplier`, `Arrival`, `Withdrawal`, `Reinforce`, `Upgrade`, `Map_Hex_ID`, `Side_ID`, `Loc_X`, `Loc_Y`, `Mission_ID`, `Scenario_ID`) VALUES 
(1, 'Red Platoon 1', 1, 100, 100, 100, 1, 1, 'red_infantry.png', 0, 0, 1, 1, 0, 0, 'No', 'No', 1, 2, 275, 100, 2, 1),
(2, 'Blue Platoon 1', 2, 50, 100, 100, 1, 1, 'blue_infantry.png', 0, 0, 1, 1, 0, 0, 'No', 'No', 1, 1, 375, 100, 2, 1);",
"CREATE TABLE ".MPREFIX."otwg_unit_equipment (
  ID int(11) NOT NULL auto_increment,
  Unit_ID int(11) NOT NULL default '0',
  Equipment_ID int(11) NOT NULL default '0',
  Auth int(11) NOT NULL default '0',
  Assig int(11) NOT NULL default '0',
  PRIMARY KEY  (ID)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=11;",
"INSERT INTO ".MPREFIX."otwg_unit_equipment (`ID`, `Unit_ID`, `Equipment_ID`, `Auth`, `Assig`) VALUES 
(1, 1, 1, 1, 1),
(2, 1, 2, 2, 2),
(3, 1, 3, 1, 1),
(4, 1, 4, 0, 2),
(5, 1, 5, 1, 1),
(6, 2, 1, 1, 1),
(7, 2, 2, 2, 2),
(8, 2, 3, 1, 1),
(9, 2, 4, 0, 2),
(10, 2, 5, 1, 1);",
"CREATE TABLE ".MPREFIX."otwg_unit_status (
  ID int(11) NOT NULL auto_increment,
  Name varchar(15) NOT NULL default 'OK',
  PRIMARY KEY  (ID)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=2;",
"INSERT INTO ".MPREFIX."otwg_unit_status (`ID`, `Name`) VALUES 
(1, 'OK');",
"CREATE TABLE ".MPREFIX."otwg_unit_subtype (
  ID int(11) NOT NULL auto_increment,
  Unit_Type_ID int(11) NOT NULL default '0',
  Name varchar(20) NOT NULL default '',
  PRIMARY KEY  (ID)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=4;",
"INSERT INTO ".MPREFIX."otwg_unit_subtype (`ID`, `Unit_Type_ID`, `Name`) VALUES 
(1, 1, 'Combat'),
(2, 1, 'HQ'),
(3, 1, 'Artillery');",
"CREATE TABLE ".MPREFIX."otwg_unit_type (
  ID int(11) NOT NULL auto_increment,
  Name varchar(15) NOT NULL default 'Ground',
  PRIMARY KEY  (ID)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=2;",
"INSERT INTO ".MPREFIX."otwg_unit_type (`ID`, `Name`) VALUES 
(1, 'Ground');");

// Create a link in main menu (yes=TRUE, no=FALSE) -------------------------------------------------------------
$eplug_link = TRUE;
$eplug_link_name = "OTWG";
$eplug_link_url = e_PLUGIN_ABS.$eplug_folder."/index.php";
$eplug_link_url = $PLUGINS_DIRECTORY."e107_plugins/".$eplug_folder."/index.php";
$eplug_link_perms = "Member";

// Text to display after plugin successfully installed ------------------------------------------------------------------
$eplug_done = "OTWG version ".$eplug_version." successfully installed!";

// upgrading ... //
$upgrade_add_prefs = "";
$upgrade_remove_prefs = "";
$upgrade_alter_tables = "";
$eplug_upgrade_done = "OTWG successfully updated!";
?>
Return current item: OTWG - Online Turn based War Game