DROP TABLE IF EXISTS `char_pk`;
CREATE TABLE `char_pk` (
`char_id` INT(11) NOT NULL,
`kill_count` INT(11) NOT NULL DEFAULT '0',
`death_count` INT(11) NOT NULL DEFAULT '0',
`score` INT(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`char_id`)
) ENGINE=InnoDB;
DROP TABLE IF EXISTS `char_pvp`;
CREATE TABLE `char_pvp` (
`char_id` INT(11) NOT NULL,
`kill_count` INT(11) NOT NULL DEFAULT '0',
`death_count` INT(11) NOT NULL DEFAULT '0',
`score` INT(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`char_id`)
) ENGINE=InnoDB;
DROP TABLE IF EXISTS `guild_rank`;
CREATE TABLE `guild_rank` (
`guild_id` INT(11) NOT NULL,
`castle_id` INT(11) NOT NULL,
`capture` INT(11) UNSIGNED NOT NULL DEFAULT '0',
`emperium` INT(11) UNSIGNED NOT NULL DEFAULT '0',
`treasure` INT(11) UNSIGNED NOT NULL DEFAULT '0',
`top_eco` INT(11) UNSIGNED NOT NULL DEFAULT '0',
`top_def` INT(11) UNSIGNED NOT NULL DEFAULT '0',
`invest_eco` INT(11) UNSIGNED NOT NULL DEFAULT '0',
`invest_def` INT(11) UNSIGNED NOT NULL DEFAULT '0',
`offensive_score` INT(11) UNSIGNED NOT NULL DEFAULT '0',
`defensive_score` INT(11) UNSIGNED NOT NULL DEFAULT '0',
`posesion_time` INT(11) UNSIGNED NOT NULL DEFAULT '0',
`zeny_eco` INT(11) UNSIGNED NOT NULL DEFAULT '0',
`zeny_def` INT(11) UNSIGNED NOT NULL DEFAULT '0',
`skill_battleorder` INT(11) UNSIGNED NOT NULL DEFAULT '0',
`skill_regeneration` INT(11) UNSIGNED NOT NULL DEFAULT '0',
`skill_restore` INT(11) UNSIGNED NOT NULL DEFAULT '0',
`skill_emergencycall` INT(11) UNSIGNED NOT NULL DEFAULT '0',
`off_kill` INT(11) UNSIGNED NOT NULL DEFAULT '0',
`off_death` INT(11) UNSIGNED NOT NULL DEFAULT '0',
`def_kill` INT(11) UNSIGNED NOT NULL DEFAULT '0',
`def_death` INT(11) UNSIGNED NOT NULL DEFAULT '0',
`ext_kill` INT(11) UNSIGNED NOT NULL DEFAULT '0',
`ext_death` INT(11) UNSIGNED NOT NULL DEFAULT '0',
`ali_kill` INT(11) UNSIGNED NOT NULL DEFAULT '0',
`ali_death` INT(11) UNSIGNED NOT NULL DEFAULT '0',
PRIMARY KEY (`guild_id`,`castle_id`),
KEY `castle_id` (`castle_id`)
) ENGINE=InnoDB;
DROP TABLE IF EXISTS `ippremium`;
CREATE TABLE `ippremium` (
`ip` VARCHAR(30) NOT NULL,
`level` tinyint(2) DEFAULT '0',
PRIMARY KEY (`ip`)
) ENGINE=InnoDB;
DROP TABLE IF EXISTS `members`;
CREATE TABLE `members` (
`member_id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`nombre` VARCHAR(50) NOT NULL DEFAULT '',
`email` VARCHAR(39) NOT NULL DEFAULT '',
`sexo` enum('M','F') NOT NULL DEFAULT 'M',
`pais` VARCHAR(20) NOT NULL DEFAULT '',
`msn` VARCHAR(39) NOT NULL DEFAULT '',
`icq` VARCHAR(15) NOT NULL DEFAULT '',
`mpass` VARCHAR(40) NOT NULL DEFAULT '',
`last_ip` VARCHAR(20) NOT NULL DEFAULT '0.0.0.0',
`last_login` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`acc_balance` INT(10) UNSIGNED NOT NULL DEFAULT '0',
`services` SMALLINT(5) UNSIGNED NOT NULL DEFAULT '0',
`banned` tinyint(1) UNSIGNED NOT NULL DEFAULT '0',
`ref_option` tinyint(3) UNSIGNED NOT NULL DEFAULT '0',
`ref_email` VARCHAR(39) NOT NULL DEFAULT 'none',
`ref_points` SMALLINT(5) UNSIGNED NOT NULL DEFAULT '0',
`mlevel` tinyint(1) UNSIGNED NOT NULL DEFAULT '0',
PRIMARY KEY (`member_id`)
) ENGINE=InnoDB;
--
-- Table structure for table `picklog`
--
DROP TABLE IF EXISTS `rentstorage`;
CREATE TABLE `rentstorage` (
`id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`account_id` INT(11) UNSIGNED NOT NULL DEFAULT '0',
`nameid` INT(11) UNSIGNED NOT NULL DEFAULT '0',
`amount` SMALLINT(11) UNSIGNED NOT NULL DEFAULT '0',
`equip` mediumint(8) UNSIGNED NOT NULL DEFAULT '0',
`identify` SMALLINT(6) UNSIGNED NOT NULL DEFAULT '0',
`refine` tinyint(3) UNSIGNED NOT NULL DEFAULT '0',
`attribute` tinyint(4) UNSIGNED NOT NULL DEFAULT '0',
`card0` SMALLINT(11) NOT NULL DEFAULT '0',
`card1` SMALLINT(11) NOT NULL DEFAULT '0',
`card2` SMALLINT(11) NOT NULL DEFAULT '0',
`card3` SMALLINT(11) NOT NULL DEFAULT '0',
`expire_time` INT(11) UNSIGNED NOT NULL DEFAULT '0',
`serial` INT(11) UNSIGNED NOT NULL DEFAULT '0',
`bound` tinyint(1) UNSIGNED NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
KEY `account_id` (`account_id`)
) ENGINE=InnoDB;
--
-- Table structure for table `skillcooldown`
--
CREATE TABLE IF NOT EXISTS `skillcooldown` (
`account_id` INT(11) UNSIGNED NOT NULL,
`char_id` INT(11) UNSIGNED NOT NULL,
`skill` SMALLINT(11) UNSIGNED NOT NULL DEFAULT '0',
`tick` INT(11) NOT NULL,
KEY (`account_id`),
KEY (`char_id`)
) ENGINE=InnoDB;
--
-- Item Serialization Update. Rev. 177 eAmod A
--
DROP TABLE IF EXISTS `item_serials`;
CREATE TABLE `item_serials` (
`nameid` SMALLINT(5) UNSIGNED NOT NULL,
`serial` INT(11) UNSIGNED NOT NULL DEFAULT '0',
PRIMARY KEY (`nameid`)
) ENGINE=InnoDB;
--
-- Tierra Domination Ranking. Rev 352 eAmod A
--
DROP TABLE IF EXISTS `char_bg`;
CREATE TABLE `char_bg` (
`char_id` INT(11) NOT NULL,
`top_damage` INT(11) NOT NULL DEFAULT '0',
`damage_done` INT(11) NOT NULL DEFAULT '0',
`damage_received` INT(11) NOT NULL DEFAULT '0',
`skulls` INT(11) NOT NULL DEFAULT '0',
`ti_wins` INT(11) NOT NULL DEFAULT '0',
`ti_lost` INT(11) NOT NULL DEFAULT '0',
`ti_tie` INT(11) NOT NULL DEFAULT '0',
`eos_flags` INT(11) NOT NULL DEFAULT '0',
`eos_bases` INT(11) NOT NULL DEFAULT '0',
`eos_wins` INT(11) NOT NULL DEFAULT '0',
`eos_lost` INT(11) NOT NULL DEFAULT '0',
`eos_tie` INT(11) NOT NULL DEFAULT '0',
`boss_killed` INT(11) NOT NULL DEFAULT '0',
`boss_damage` INT(11) NOT NULL DEFAULT '0',
`boss_flags` INT(11) NOT NULL DEFAULT '0',
`boss_wins` INT(11) NOT NULL DEFAULT '0',
`boss_lost` INT(11) NOT NULL DEFAULT '0',
`boss_tie` INT(11) NOT NULL DEFAULT '0',
`dom_bases` INT(11) NOT NULL DEFAULT '0',
`dom_off_kills` INT(11) NOT NULL DEFAULT '0',
`dom_def_kills` INT(11) NOT NULL DEFAULT '0',
`dom_wins` INT(11) NOT NULL DEFAULT '0',
`dom_lost` INT(11) NOT NULL DEFAULT '0',
`dom_tie` INT(11) NOT NULL DEFAULT '0',
`td_kills` INT(11) NOT NULL DEFAULT '0',
`td_deaths` INT(11) NOT NULL DEFAULT '0',
`td_wins` INT(11) NOT NULL DEFAULT '0',
`td_lost` INT(11) NOT NULL DEFAULT '0',
`td_tie` INT(11) NOT NULL DEFAULT '0',
`sc_stole` INT(11) NOT NULL DEFAULT '0',
`sc_captured` INT(11) NOT NULL DEFAULT '0',
`sc_droped` INT(11) NOT NULL DEFAULT '0',
`sc_wins` INT(11) NOT NULL DEFAULT '0',
`sc_lost` INT(11) NOT NULL DEFAULT '0',
`sc_tie` INT(11) NOT NULL DEFAULT '0',
`ctf_taken` INT(11) NOT NULL DEFAULT '0',
`ctf_captured` INT(11) NOT NULL DEFAULT '0',
`ctf_droped` INT(11) NOT NULL DEFAULT '0',
`ctf_wins` INT(11) NOT NULL DEFAULT '0',
`ctf_lost` INT(11) NOT NULL DEFAULT '0',
`ctf_tie` INT(11) NOT NULL DEFAULT '0',
`emperium_kill` INT(11) NOT NULL DEFAULT '0',
`barricade_kill` INT(11) NOT NULL DEFAULT '0',
`gstone_kill` INT(11) NOT NULL DEFAULT '0',
`cq_wins` INT(11) NOT NULL DEFAULT '0',
`cq_lost` INT(11) NOT NULL DEFAULT '0',
`kill_count` INT(11) NOT NULL DEFAULT '0',
`death_count` INT(11) NOT NULL DEFAULT '0',
`win` INT(11) NOT NULL DEFAULT '0',
`lost` INT(11) NOT NULL DEFAULT '0',
`tie` INT(11) NOT NULL DEFAULT '0',
`leader_win` INT(11) NOT NULL DEFAULT '0',
`leader_lost` INT(11) NOT NULL DEFAULT '0',
`leader_tie` INT(11) NOT NULL DEFAULT '0',
`deserter` INT(11) NOT NULL DEFAULT '0',
`score` INT(11) NOT NULL DEFAULT '0',
`points` INT(11) NOT NULL DEFAULT '0',
`sp_heal_potions` INT(11) NOT NULL DEFAULT '0',
`hp_heal_potions` INT(11) NOT NULL DEFAULT '0',
`yellow_gemstones` INT(11) NOT NULL DEFAULT '0',
`red_gemstones` INT(11) NOT NULL DEFAULT '0',
`blue_gemstones` INT(11) NOT NULL DEFAULT '0',
`poison_bottles` INT(11) NOT NULL DEFAULT '0',
`acid_demostration` INT(11) NOT NULL DEFAULT '0',
`acid_demostration_fail` INT(11) NOT NULL DEFAULT '0',
`support_skills_used` INT(11) NOT NULL DEFAULT '0',
`healing_done` INT(11) NOT NULL DEFAULT '0',
`wrong_support_skills_used` INT(11) NOT NULL DEFAULT '0',
`wrong_healing_done` INT(11) NOT NULL DEFAULT '0',
`sp_used` INT(11) NOT NULL DEFAULT '0',
`zeny_used` INT(11) NOT NULL DEFAULT '0',
`spiritb_used` INT(11) NOT NULL DEFAULT '0',
`ammo_used` INT(11) NOT NULL DEFAULT '0',
`rank_points` INT(11) NOT NULL DEFAULT '0',
`rank_games` INT(11) NOT NULL DEFAULT '0',
`ru_captures` INT(11) NOT NULL DEFAULT '0',
`ru_wins` INT(11) NOT NULL DEFAULT '0',
`ru_lost` INT(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`char_id`)
) ENGINE=InnoDB;
--
-- New Kill Log Update. Rev. 183 eAmod A
--
DROP TABLE IF EXISTS `char_bg_log`;
CREATE TABLE `char_bg_log` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`killer` VARCHAR(25) NOT NULL,
`killer_id` INT(11) NOT NULL,
`killed` VARCHAR(25) NOT NULL,
`killed_id` INT(11) NOT NULL,
`map` VARCHAR(11) NOT NULL DEFAULT '',
`skill` INT(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
KEY `killer_id` (`killer_id`),
KEY `killed_id` (`killed_id`)
) ENGINE=MyISAM;
DROP TABLE IF EXISTS `char_woe_log`;
CREATE TABLE `char_woe_log` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`killer` VARCHAR(25) NOT NULL,
`killer_id` INT(11) NOT NULL,
`killed` VARCHAR(25) NOT NULL,
`killed_id` INT(11) NOT NULL,
`map` VARCHAR(11) NOT NULL DEFAULT '',
`skill` INT(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
KEY `killer_id` (`killer_id`),
KEY `killed_id` (`killed_id`)
) ENGINE=MyISAM;
--
-- New Kill Log Update. Rev. 186 eAmod A
--
DROP TABLE IF EXISTS `char_woe`;
DROP TABLE IF EXISTS `char_wstats`;
CREATE TABLE `char_wstats` (
`char_id` INT(11) NOT NULL,
`kill_count` INT(11) NOT NULL DEFAULT '0',
`death_count` INT(11) NOT NULL DEFAULT '0',
`score` INT(11) NOT NULL DEFAULT '0',
`top_damage` INT(11) NOT NULL DEFAULT '0',
`damage_done` INT(11) NOT NULL DEFAULT '0',
`damage_received` INT(11) NOT NULL DEFAULT '0',
`emperium_damage` INT(11) NOT NULL DEFAULT '0',
`guardian_damage` INT(11) NOT NULL DEFAULT '0',
`barricade_damage` INT(11) NOT NULL DEFAULT '0',
`gstone_damage` INT(11) NOT NULL DEFAULT '0',
`emperium_kill` INT(11) NOT NULL DEFAULT '0',
`guardian_kill` INT(11) NOT NULL DEFAULT '0',
`barricade_kill` INT(11) NOT NULL DEFAULT '0',
`gstone_kill` INT(11) NOT NULL DEFAULT '0',
`sp_heal_potions` INT(11) NOT NULL DEFAULT '0',
`hp_heal_potions` INT(11) NOT NULL DEFAULT '0',
`yellow_gemstones` INT(11) NOT NULL DEFAULT '0',
`red_gemstones` INT(11) NOT NULL DEFAULT '0',
`blue_gemstones` INT(11) NOT NULL DEFAULT '0',
`poison_bottles` INT(11) NOT NULL DEFAULT '0',
`acid_demostration` INT(11) NOT NULL DEFAULT '0',
`acid_demostration_fail` INT(11) NOT NULL DEFAULT '0',
`support_skills_used` INT(11) NOT NULL DEFAULT '0',
`healing_done` INT(11) NOT NULL DEFAULT '0',
`wrong_support_skills_used` INT(11) NOT NULL DEFAULT '0',
`wrong_healing_done` INT(11) NOT NULL DEFAULT '0',
`sp_used` INT(11) NOT NULL DEFAULT '0',
`zeny_used` INT(11) NOT NULL DEFAULT '0',
`spiritb_used` INT(11) NOT NULL DEFAULT '0',
`ammo_used` INT(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`char_id`)
) ENGINE=InnoDB;
DROP TABLE IF EXISTS `skill_count`;
CREATE TABLE `skill_count` (
`char_id` INT(11) UNSIGNED NOT NULL DEFAULT '0',
`id` SMALLINT(11) UNSIGNED NOT NULL DEFAULT '0',
`count` INT(11) UNSIGNED NOT NULL DEFAULT '0',
PRIMARY KEY (`char_id`,`id`),
KEY `char_id` (`char_id`)
) ENGINE=InnoDB;
DROP TABLE IF EXISTS `bg_skill_count`;
CREATE TABLE `bg_skill_count` (
`char_id` INT(11) UNSIGNED NOT NULL DEFAULT '0',
`id` SMALLINT(11) UNSIGNED NOT NULL DEFAULT '0',
`count` INT(11) UNSIGNED NOT NULL DEFAULT '0',
PRIMARY KEY (`char_id`,`id`),
KEY `char_id` (`char_id`)
) ENGINE=InnoDB;
--
-- Achievement Database. Rev 337 eAmod A
--
DROP TABLE IF EXISTS `achievement`;
CREATE TABLE `achievement` (
`id` INT(11) NOT NULL,
`char_id` INT(11) NOT NULL,
`completed` tinyint(1) UNSIGNED NOT NULL DEFAULT '0',
`count1` INT(11) UNSIGNED NOT NULL DEFAULT '0',
`count2` INT(11) UNSIGNED NOT NULL DEFAULT '0',
`count3` INT(11) UNSIGNED NOT NULL DEFAULT '0',
`count4` INT(11) UNSIGNED NOT NULL DEFAULT '0',
`count5` INT(11) UNSIGNED NOT NULL DEFAULT '0',
PRIMARY KEY (`char_id`,`id`)
) ENGINE=InnoDB;
delimiter '//'
CREATE PROCEDURE addcol(IN tablename VARCHAR(100), IN new_colname VARCHAR(100),IN valtype VARCHAR(10), IN defval VARCHAR(10) ) BEGIN
IF NOT EXISTS(
SELECT * FROM information_schema.COLUMNS
WHERE COLUMN_NAME='new_colname' AND TABLE_NAME='tablename'
)
THEN
ALTER TABLE `tablename` ADD COLUMN `new_colname` 'valtype' UNSIGNED NOT NULL DEFAULT 'defval';
END IF;
END;
//
delimiter ';'
CALL addcol(`char`,`bg_gold`,'int(11)','0');
CALL addcol(`char`,`bg_silver`,'int(11)','0');
CALL addcol(`char`,`bg_bronze`,'int(11)','0');
CALL addcol(`char`,`playtime`,'bigint(20)','0');
CALL addcol(`char`,`faction_id`,'int(11)','0');
CALL addcol(`login`,`ipallow`,'varchar(20','*.*.*.*');
CALL addcol(`login`,`member_id`,'int(11)','0');
CALL addcol(`inventory`,`bound`,'tinyint(1)','0');
CALL addcol(`cart_inventory`,`bound`,'tinyint(1)','0');
CALL addcol(`storage`,`bound`,'tinyint(1)','0');
CALL addcol(`rentstorage`,`bound`,'tinyint(1)','0');
CALL addcol(`guild_storage`,`bound`,'tinyint(1)','0');
CALL addcol(`inventory`,`favorite`,'tinyint(1)','0');
CALL addcol(`cart_inventory`,`favorite`,'tinyint(1)','0');
CALL addcol(`storage`,`favorite`,'tinyint(1)','0');
CALL addcol(`rentstorage`,`favorite`,'tinyint(1)','0');
CALL addcol(`guild_storage`,`favorite`,'tinyint(1)','0');
CALL addcol(`auction`,`serial`,'int(11)','0');
CALL addcol(`mail`,`serial`,'int(11)','0');
CALL addcol(`inventory`,`serial`,'int(11)','0');
CALL addcol(`cart_inventory`,`serial`,'int(11)','0');
CALL addcol(`storage`,`serial`,'int(11)','0');
CALL addcol(`rentstorage`,`serial`,'int(11)','0');
CALL addcol(`guild_storage`,`serial`,'int(11)','0');
DROP PROCEDURE addcol;