-- --------------------------------------------------------
-- Host:                         127.0.0.1
-- Server version:               10.4.21-MariaDB - mariadb.org binary distribution
-- Server OS:                    Win64
-- HeidiSQL Version:             11.3.0.6295
-- --------------------------------------------------------

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET NAMES utf8 */;
/*!50503 SET NAMES utf8mb4 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;

-- Dumping structure for table epoch_database.Character_DATA
CREATE TABLE IF NOT EXISTS `Character_DATA` (
  `CharacterID` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `PlayerUID` varchar(20) NOT NULL DEFAULT '0',
  `InstanceID` int(11) NOT NULL DEFAULT 0,
  `Datestamp` datetime DEFAULT NULL,
  `LastLogin` datetime NOT NULL,
  `Inventory` longtext DEFAULT NULL,
  `Backpack` longtext DEFAULT NULL,
  `Worldspace` varchar(128) NOT NULL DEFAULT '[]',
  `Medical` varchar(300) NOT NULL DEFAULT '[]',
  `Alive` tinyint(3) unsigned NOT NULL DEFAULT 1,
  `Generation` int(11) unsigned NOT NULL DEFAULT 1,
  `LastAte` datetime NOT NULL,
  `LastDrank` datetime NOT NULL,
  `KillsZ` int(11) unsigned NOT NULL DEFAULT 0,
  `HeadshotsZ` int(11) unsigned NOT NULL DEFAULT 0,
  `DistanceFoot` int(11) NOT NULL DEFAULT 0,
  `Duration` int(11) NOT NULL DEFAULT 0,
  `CurrentState` varchar(200) NOT NULL DEFAULT '[]',
  `KillsH` int(11) unsigned NOT NULL DEFAULT 0,
  `Model` varchar(50) NOT NULL DEFAULT '"Survivor2_DZ"',
  `KillsB` int(11) unsigned NOT NULL DEFAULT 0,
  `Humanity` int(11) NOT NULL DEFAULT 2500,
  `Infected` tinyint(3) DEFAULT 0,
  `Coins` bigint(20) NOT NULL DEFAULT 0,
  PRIMARY KEY (`CharacterID`),
  KEY `PlayerUID` (`PlayerUID`) USING BTREE,
  KEY `Alive` (`Alive`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=latin1;

-- Dumping data for table epoch_database.Character_DATA: ~8 rows (approximately)
/*!40000 ALTER TABLE `Character_DATA` DISABLE KEYS */;
INSERT INTO `Character_DATA` (`CharacterID`, `PlayerUID`, `InstanceID`, `Datestamp`, `LastLogin`, `Inventory`, `Backpack`, `Worldspace`, `Medical`, `Alive`, `Generation`, `LastAte`, `LastDrank`, `KillsZ`, `HeadshotsZ`, `DistanceFoot`, `Duration`, `CurrentState`, `KillsH`, `Model`, `KillsB`, `Humanity`, `Infected`, `Coins`) VALUES
	(1, '76561198180152023', 24, '2021-09-12 07:20:51', '2021-09-12 10:34:10', '[["Makarov_SD_DZ","ItemKnife"],["ItemBandage","8Rnd_9x18_MakarovSD"],""]', '["",[[],[]],[[],[]]]', '[196,[8672.31,8945.65,0.001]]', '[false,false,false,false,false,false,false,12000,[],[0.115,0],0,"A",true,[745.896,965.691,0],false]', 0, 1, '2021-09-12 07:20:51', '2021-09-12 07:20:51', 23, 16, 5235, 56, '[["Makarov_SD_DZ","aidlpercmstpsraswpstdnon_player_idlesteady03",42],[]]', 0, 'Reporter_DZ', 0, 2615, 0, 0),
	(2, '76561198180152023', 24, '2021-09-12 10:45:24', '2021-09-14 15:32:50', '[["M60A4_EP1_DZE","Binocular_Vector","NVGoggles","Makarov_DZ","ItemCompass","ItemHatchet","ItemMap","ItemEtool","ItemToolbox","ItemCrowbar","ItemSledge","ItemKeyKit","ItemKeyGreen2477","ItemGPS"],["ItemSodaPepsi","ItemPainkiller","ItemMorphine","100Rnd_762x51_M240","100Rnd_762x51_M240","100Rnd_762x51_M240","ItemBandage","ItemBandage","ItemBandage","ItemBandage","ItemBandage","ItemBandage"],""]', '["CzechBackpack_WDL_DZE1",[[],[]],[[],[]]]', '[87,[3924.01,4308.17,0]]', '[false,false,false,false,false,false,false,12000,[],[0,0],0,"O",true,[896.5,328.445,313.285],false]', 0, 2, '2021-09-12 10:45:24', '2021-09-12 10:45:24', 7, 4, 12855, 176, '[["M60A4_EP1_DZE","aidlpercmstpsraswrfldnon_idlesteady02",42],[]]', 0, 'CamoWinter1W_DZ', 0, 7650, 0, 127720),
	(4, '76561198180152023', 24, '2021-09-14 15:34:05', '2021-09-23 11:20:09', '[["Pecheneg_DZ","NVGoggles","Makarov_DZ","ItemRadio","ItemHatchet","ItemEtool","ItemCrowbar","ItemCompass","ItemGPS","Binocular","ItemToolbox","ItemWatch"],["FoodPistachio","ItemMorphine","ItemSodaLvg","FoodCanPasta","100Rnd_762x54_PK","ItemSodaOrangeSherbet","20Rnd_762x51_DMR","100Rnd_762x54_PK","ItemPainkiller6","8Rnd_9x18_Makarov","8Rnd_9x18_Makarov"],"DMR_Gh_DZE"]', '["LargeGunBag_DZE2",[["BAF_AS50_scoped_DZ"],[1]],[["100Rnd_762x54_PK","20Rnd_762x51_DMR","MAAWS_HEAT","ItemMorphine","ItemSodaLvg"],[4,12,1,1,1]]]', '[103,[6507.89,9619.32,0]]', '[false,false,false,false,false,false,false,12000,[],[0,0],0,"A",true,[129.904,67.561,0],false]', 0, 3, '2021-09-14 15:34:05', '2021-09-14 15:34:05', 36, 21, 52672, 120, '[["","",42],[]]', 0, 'CZ_Soldier_Light_Wdl_ACR_DZ', 28, 9630, 0, 0),
	(5, '76561198180152023', 24, '2021-09-23 11:33:13', '2021-09-23 11:33:16', '[["Revolver_DZ"],["HandRoadFlare","ItemPainkiller","ItemWaterBottle","FoodPistachio","ItemBandage","ItemBandage","6Rnd_45ACP","6Rnd_45ACP"],""]', '["",[[],[]],[[],[]]]', '[137,[540.411,11170.5,0.001]]', '[false,false,false,false,false,false,false,12000,[],[0,0],0,"AB",true,[0,12.533,0],false]', 0, 4, '2021-09-23 11:33:13', '2021-09-23 11:33:13', 0, 0, 4655, 3, '[["Revolver_DZ","amovpercmstpsraswpstdnon_gear",37],[]]', 0, 'SurvivorW2_DZ', 0, 9630, 0, 0),
	(6, '76561198180152023', 24, '2021-09-23 11:39:14', '2021-09-23 11:39:18', '[["G17_DZ"],["ItemPainkiller","ItemWaterBottle","FoodPistachio","ItemBandage","ItemBandage","17Rnd_9x19_glock17","17Rnd_9x19_glock17"],""]', '["",[[],[]],[[],[]]]', '[121,[10416.9,16932.8,0.001]]', '[false,false,false,false,false,false,false,12000,[],[0,0],0,"A",false,[0,0,0],false]', 0, 5, '2021-09-23 11:39:14', '2021-09-23 11:39:14', 0, 0, 0, 0, '[["G17_DZ","amovpknlmstpsraswpstdnon",37],[]]', 0, 'SurvivorW2_DZ', 0, 9630, 0, 0),
	(10, '76561198180152023', 24, '2021-09-23 11:58:16', '2021-09-24 13:18:17', '[["DMR_DZ","Binocular_Vector","NVGoggles","G17_DZ","ItemRadio","ItemCompass","ItemWatch","ItemMap","ItemToolbox","ItemGPS","ItemKeyGreen2477","ItemKeyKit"],["ItemMorphine","ItemSodaMtngreen","ItemBandage","17Rnd_9x19_glock17","17Rnd_9x19_glock17","ItemBandage","ItemBandage","20Rnd_762x51_DMR","ItemBloodbag","ItemPainkillerEmpty","ItemBloodbag","ItemBloodbag","20Rnd_762x51_DMR","20Rnd_762x51_DMR","20Rnd_762x51_DMR","PartVRotor","ItemDocument"],""]', '["LargeGunBag_DZE1",[["Mk48_CCO_DZ","HK417_Holo_DZ","M136"],[1,1,1]],[["100Rnd_762x51_M240","M136"],[3,2]]]', '[292,[6915.02,14059,0]]', '[false,false,false,false,false,false,false,12001.3,[],[0.483,0],0,"O",true,[221.651,105.946,34.786],false]', 0, 6, '2021-09-23 11:58:16', '2021-09-23 11:58:16', 7, 7, 79299, 267, '[["","",37],[]]', 15, 'CamoWinter2W_DZ', 32, 9960, 0, 0),
	(11, '76561198180152023', 24, '2021-09-24 13:18:53', '2021-09-27 11:33:19', '[["Binocular_Vector","NVGoggles","G17_DZ","ItemRadio","ItemCompass","ItemWatch","ItemMap","ItemGPS","ItemKeyYellow43","ItemKeyYellow2238","Pecheneg_DZ"],["ItemSodaCoke","20Rnd_762x51_DMR","20Rnd_762x51_DMR","17Rnd_9x19_glock17","17Rnd_9x19_glock17","ItemBandage","ItemBandage","100Rnd_762x54_PK","20Rnd_762x51_DMR","20Rnd_762x51_DMR","20Rnd_762x51_DMR","ItemPainkiller6","100Rnd_762x54_PK","20Rnd_762x51_DMR","ItemMorphine","ItemBloodbag"],"DMR_DZ"]', '["",[[],[]],[[],[]]]', '[22,[2096.79,8345.11,0.001]]', '[false,false,false,false,false,false,false,12000.8,[],[0,0],0,"B",true,[525.363,233.135,0],false]', 0, 7, '2021-09-24 13:18:53', '2021-09-24 13:18:53', 16, 11, 92061, 393, '[["Pecheneg_DZ","amovpknlmstpsraswrfldnon_diary",37],[]]', 67, 'SurvivorW2_DZ', 59, 9390, 0, 0),
	(12, '76561198180152023', 24, '2021-09-27 11:33:52', '2021-09-29 10:32:17', '[["Binocular_Vector","NVGoggles","G17_DZ","ItemRadio","ItemCompass","ItemToolbox","ItemWatch","ItemMap","ItemGPS","ItemKeyYellow43","DMR_DZ"],[["20Rnd_762x51_DMR",16],["20Rnd_762x51_DMR",7],["20Rnd_762x51_DMR",9],"20Rnd_762x51_DMR",["100Rnd_762x54_PK",84],"100Rnd_762x54_PK","ItemMorphine","ItemBloodbag","ItemPainkiller5","20Rnd_762x51_DMR","ItemBandage",["17Rnd_9x19_glock17",16],"17Rnd_9x19_glock17","ItemBandage","ItemBandage"],"Pecheneg_DZ"]', '["",[[],[]],[[],[]]]', '[56,[4781.39,7749.16,0.002]]', '[false,false,false,false,false,false,true,11947,[],[0,0],0,"A",true,[856.92,412.536,0],false]', 1, 8, '2021-09-27 11:33:52', '2021-09-27 11:33:52', 3, 3, 67356, 85, '[["DMR_DZ","amovpknlmstpsraswrfldnon",37],[]]', 48, 'SurvivorW2_DZ', 50, 9505, 0, 0);
/*!40000 ALTER TABLE `Character_DATA` ENABLE KEYS */;

-- Dumping structure for table epoch_database.garage
CREATE TABLE IF NOT EXISTS `garage` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `PlayerUID` varchar(20) NOT NULL DEFAULT '0',
  `Name` varchar(50) NOT NULL DEFAULT '',
  `DisplayName` varchar(50) NOT NULL DEFAULT '',
  `Classname` varchar(50) DEFAULT NULL,
  `Datestamp` timestamp NULL DEFAULT current_timestamp(),
  `DateStored` varchar(10) NOT NULL DEFAULT 'old',
  `DateMaintained` timestamp NOT NULL DEFAULT current_timestamp(),
  `CharacterID` bigint(20) unsigned NOT NULL DEFAULT 0,
  `StorageCounts` varchar(30) NOT NULL DEFAULT '[0,0,0]',
  `Inventory` mediumtext DEFAULT NULL,
  `Hitpoints` mediumtext DEFAULT NULL,
  `Fuel` double(13,5) NOT NULL DEFAULT 1.00000,
  `Damage` double(13,5) NOT NULL DEFAULT 0.00000,
  `Colour` varchar(50) NOT NULL,
  `Colour2` varchar(50) NOT NULL,
  `serverKey` varchar(10) NOT NULL DEFAULT 'old',
  `ObjUID` varchar(20) NOT NULL DEFAULT 'old',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;

-- Dumping data for table epoch_database.garage: ~0 rows (approximately)
/*!40000 ALTER TABLE `garage` DISABLE KEYS */;
/*!40000 ALTER TABLE `garage` ENABLE KEYS */;

-- Dumping structure for table epoch_database.Object_DATA
CREATE TABLE IF NOT EXISTS `Object_DATA` (
  `ObjectID` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `ObjectUID` bigint(24) NOT NULL DEFAULT 0,
  `Instance` int(11) unsigned NOT NULL,
  `Classname` varchar(50) DEFAULT NULL,
  `Datestamp` datetime NOT NULL,
  `LastUpdated` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `CharacterID` bigint(20) unsigned NOT NULL DEFAULT 0,
  `Worldspace` varchar(128) NOT NULL DEFAULT '[]',
  `Inventory` longtext DEFAULT NULL,
  `Hitpoints` varchar(1024) NOT NULL DEFAULT '[]',
  `Fuel` double(13,5) NOT NULL DEFAULT 1.00000,
  `Damage` double(13,5) NOT NULL DEFAULT 0.00000,
  `StorageCoins` bigint(20) NOT NULL DEFAULT 0,
  PRIMARY KEY (`ObjectID`),
  KEY `ObjectUID` (`ObjectUID`) USING BTREE,
  KEY `Instance` (`Instance`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=519 DEFAULT CHARSET=latin1;

-- Dumping structure for table epoch_database.Player_DATA
CREATE TABLE IF NOT EXISTS `Player_DATA` (
  `PlayerUID` varchar(20) NOT NULL DEFAULT '0',
  `PlayerName` varchar(128) CHARACTER SET utf8 NOT NULL DEFAULT 'Null',
  `PlayerMorality` int(11) NOT NULL DEFAULT 0,
  `PlayerSex` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `playerGroup` varchar(2048) NOT NULL DEFAULT '[]',
  `PlayerCoins` bigint(20) NOT NULL DEFAULT 0,
  `BankCoins` bigint(20) NOT NULL DEFAULT 0,
  PRIMARY KEY (`PlayerUID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- Dumping structure for table epoch_database.Player_LOGIN
CREATE TABLE IF NOT EXISTS `Player_LOGIN` (
  `LoginID` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `PlayerUID` varchar(20) NOT NULL,
  `CharacterID` int(11) unsigned NOT NULL DEFAULT 0,
  `Datestamp` datetime NOT NULL,
  `Action` int(11) NOT NULL DEFAULT 0,
  PRIMARY KEY (`LoginID`)
) ENGINE=InnoDB AUTO_INCREMENT=432 DEFAULT CHARSET=latin1;

-- Dumping structure for procedure epoch_database.retObjID
DELIMITER //
CREATE PROCEDURE `retObjID`(
    IN objTableName VARCHAR(256),
    IN SID INT(11),
    IN UID bigint(24),
    OUT OID INT(11)unsigned
)
BEGIN
 DECLARE x INT;
 declare sqlstr VARCHAR(256);

 SET @OID = 0;
 SET @x = 1;
 SET @sqlstr = CONCAT('SELECT `ObjectID` from `', objTableName ,'` where `Instance` = ', SID ,' AND `ObjectUID` = ', UID ,' INTO @OID');
 PREPARE stmt FROM @sqlstr;

 WHILE (@x <= 5) DO
  EXECUTE stmt;
  IF (@OID > 0) then 
   SET @x = 6;
  else
   SET  @x = @x + 1;
   DO sleep(0.1);
  END IF;
 END WHILE;
 DEALLOCATE PREPARE stmt;
 SET OID = @OID;
 SELECT @OID;
END//
DELIMITER ;

/*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */;
/*!40014 SET FOREIGN_KEY_CHECKS=IFNULL(@OLD_FOREIGN_KEY_CHECKS, 1) */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40111 SET SQL_NOTES=IFNULL(@OLD_SQL_NOTES, 1) */;
