1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-27 06:47:45 +00:00

Added a new table for spawnpoints and initial data

This commit is contained in:
Mordred 2018-12-30 17:36:30 +01:00
parent bd8fcfc0a8
commit b2b38d2f10
3 changed files with 353 additions and 7 deletions

File diff suppressed because one or more lines are too long

View file

@ -27,6 +27,17 @@ CREATE TABLE `bnpctemplate` (
KEY `templatename` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `spawnpoint` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`spawnGroupId` int(11) NOT NULL,
`x` float NOT NULL,
`y` float NOT NULL,
`z` float NOT NULL,
`r` float NOT NULL,
PRIMARY KEY (`id`),
KEY `spawngroupidx` (`spawnGroupId`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE `charainfo` (
`AccountId` int(11) NOT NULL,
`CharacterId` int(20) NOT NULL,
@ -535,14 +546,12 @@ CREATE TABLE `houseiteminventory` (
INDEX `landIdent` (`LandIdent`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE `spawngroup` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`territoryTypeId` int(5) NOT NULL,
`bNpcTemplateId` int(10) NOT NULL,
`level` int(3) NOT NULL,
`maxHp` int(10) NOT NULL,
`gimmickId` int(10) NOT NULL,
PRIMARY KEY(`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

View file

@ -250,7 +250,7 @@ int dumpSpawns()
}
//std::ofstream out("output.txt");
std::ofstream out("output_1.txt");
int spawngroups = 0;
for( auto entry : zoneToPacketList )
@ -285,6 +285,23 @@ int dumpSpawns()
auto nameStruct = g_exdData.get< Sapphire::Data::BNpcName >( mobName.second.at(0).bNPCName );
Logger::info( "|--> " + nameStruct->singular + "(" + std::to_string( mobName.second.size() ) + ")" );
Logger::info( "|-> " + std::to_string( entry.first ) );
std::string name1 = delChar( nameStruct->singular, ' ' );
name1 = delChar( name1, '\'' );
std::string templateName = name1 + "_" + std::to_string( mobName.second.at(0).bNPCBase );
std::string output = "INSERT IGNORE INTO `spawngroup` ( `territoryTypeId`, `bNpcTemplateId`, `level`, `maxHp` ) "
" VALUES ( " + std::to_string( entry.first ) +
", ( SELECT id FROM bnpctemplate WHERE name = '" + templateName + "' ) , " +
std::to_string( mobName.second.at(0).level ) + ", " +
std::to_string( mobName.second.at(0).hPMax ) + " );";
output += "\nSET @last_id_spawngroup = LAST_INSERT_ID(); ";
spawngroups++;
for( FFXIVIpcNpcSpawn instance : mobName.second )
{
@ -298,7 +315,6 @@ int dumpSpawns()
modelStr += "]";
std::string cusStr = "[";
for( auto cusEntry : instance.look )
@ -315,7 +331,8 @@ int dumpSpawns()
std::string name = delChar( nameStruct->singular, ' ' );
name = delChar( name, '\'' );
Logger::info( "|----> " + name + "_" + std::to_string( instance.bNPCBase ) + " " +
Logger::info( "|----> " + name + "_" +
std::to_string( instance.bNPCBase ) + " " +
std::to_string( instance.posX ) + ", " +
std::to_string( instance.posY ) + ", " +
std::to_string( instance.posZ ) + ", " +
@ -325,6 +342,14 @@ int dumpSpawns()
std::to_string( instance.hPMax ) );
//Logger::info( "|----> " + name + " - " + std::to_string( instance.bNPCBase ) + ", " + std::to_string( instance.gimmickId ) );
output += "INSERT INTO `spawnpoint` ( `spawngroupid`, `x`, `y`, `z`, `r` ) "
" VALUES ( @last_id_spawngroup, " +
std::to_string( instance.posX ) + ", " +
std::to_string( instance.posY ) + ", " +
std::to_string( instance.posZ ) + ", " +
std::to_string( 0 ) + " ); ";
//Logger::info( output );
/*std::string output = "INSERT IGNORE INTO `bnpctemplate` ( `Name`, `bNPCBaseId`, `bNPCNameId`, `mainWeaponModel`, `secWeaponModel`, `aggressionMode`, `enemyType`, `pose`, `modelChara`, `displayFlags`, `Look`, `Models`) "
@ -343,10 +368,11 @@ int dumpSpawns()
//Logger::info( output );
//out << output;
}
out << output;
}
nameToPacketList.clear();
@ -572,7 +598,8 @@ int dumpTemplates()
int main()
{
dumpTemplates();
//dumpTemplates();
dumpSpawns();
return 0;
}