domingo, 20 de dezembro de 2015

Rust Experimental - SQLStats


This plugin collects various data from in game, and saves it to MySQL database. This allows server owners to have nice statistics of whats happening in their server, and also allows them to display those statistics on their website.

Donations would motivate me to do few more plugins: SQLRanks and SQLAchiements. Which would allow you to display such details in game using GUI. So even beginner server owners could make use of SQLStats plugin.

Plugin logs these events (so far):
  • Player login [Table: stats_player]

  • Player animal kills [Table: stats_player_animal_kill]

  • Player crafted items list and count for each day for each player. [Table: stats_player_craft_item]

  • Player death information for each day. Statistics such as how many times player died from cold/bullet/fall/etc on 2015-12-10 for example. [Table: stats_player_death]

  • Statistics about player destroyed buildings. [Table: stats_player_destroy_building]

  • Statistics about player bullet shots for each day. [Table: stats_player_fire_bullet]

  • Statistic about resources player gathered certain day. [Table: stats_player_gather_resource]

  • Statistics about player kills in PvP. [Table: stats_player_kill]

  • Statistic about player placed building objects. [Table: stats_player_place_building]

  • Statistic about player placed deployable objects(such as Campfires, Auto Turrets, etc). [Table:stats_player_place_deployable]

Here is config file for the plugin:
Code (Text):
{
  "dbConnection": {
    "Database": "RustDB",
    "Host": "127.0.0.1",
    "Password": "RustPW",
    "Port": 3306,
    "Username": "RustUSR"
  }
Here is SQL structure which is used in my plugin:
Code (Text):
CREATE TABLE `stats_player` (
  `id` bigint(20) NOT NULL,
  `name` varchar(256) CHARACTER SET utf8 NOT NULL,
  `online_seconds` bigint(20) NOT NULL DEFAULT '0',
  `ip` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  `online` bit(1) NOT NULL DEFAULT b'0',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `stats_player_animal_kill` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `player` bigint(20) NOT NULL,
  `animal` varchar(32) NOT NULL,
  `date` datetime NOT NULL,
  `distance` int(11) DEFAULT NULL,
  `weapon` varchar(128) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE `stats_player_craft_item` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `player` bigint(20) NOT NULL,
  `item` varchar(32) NOT NULL,
  `date` date NOT NULL,
  `count` int(11) NOT NULL DEFAULT '1',
  PRIMARY KEY (`id`),
  UNIQUE KEY `PlayerItemDate` (`player`,`item`,`date`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE `stats_player_death` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `player` bigint(20) NOT NULL,
  `cause` varchar(32) NOT NULL,
  `date` date NOT NULL,
  `count` int(11) NOT NULL DEFAULT '1',
  PRIMARY KEY (`id`),
  UNIQUE KEY `PlayerCauseDate` (`player`,`cause`,`date`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE `stats_player_destroy_building` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `player` bigint(20) NOT NULL,
  `building` varchar(128) NOT NULL,
  `date` datetime NOT NULL,
  `tier` varchar(20) DEFAULT NULL,
  `weapon` varchar(128) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE `stats_player_fire_bullet` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `player` bigint(20) NOT NULL,
  `bullet` varchar(32) NOT NULL,
  `weapon` varchar(32) NOT NULL,
  `date` date NOT NULL,
  `count` int(11) NOT NULL DEFAULT '1',
  PRIMARY KEY (`id`),
  UNIQUE KEY `PlayerBulletWeaponDate` (`player`,`bullet`,`weapon`,`date`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE `stats_player_gather_resource` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `player` bigint(20) NOT NULL,
  `resource` varchar(32) NOT NULL,
  `count` bigint(20) NOT NULL,
  `date` date NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `PlayerResourceCountDate` (`player`,`resource`,`date`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE `stats_player_kill` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `killer` bigint(20) NOT NULL,
  `victim` bigint(20) NOT NULL,
  `weapon` varchar(32) NOT NULL,
  `bodypart` varchar(2000) NOT NULL DEFAULT '',
  `date` datetime NOT NULL,
  `distance` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE `stats_player_place_building` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `player` bigint(20) NOT NULL,
  `building` varchar(128) NOT NULL,
  `date` date NOT NULL,
  `count` int(11) NOT NULL DEFAULT '1',
  PRIMARY KEY (`id`),
  UNIQUE KEY `PlayerBuildingDate` (`player`,`building`,`date`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE `stats_player_place_deployable` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `player` bigint(20) NOT NULL,
  `deployable` varchar(128) NOT NULL,
  `date` date NOT NULL,
  `count` int(11) NOT NULL DEFAULT '1',
  PRIMARY KEY (`id`),
  UNIQUE KEY `PlayerDeployableDate` (`player`,`deployable`,`date`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
Download



Google Plus
← Postagem mais recente Postagem mais antiga → Página inicial

1 comentários: