@ -14,15 +14,16 @@ Money::Money(uint32_t money)
Item : : Item ( ) { }
ItemEditor : : ItemEditor ( FiestaOnlineEditor * pge , std : : string windowTitle , vi2d pos , vi2d size )
: Window ( pge , windowTitle , pos , size ) { }
ItemEditor : : ItemEditor ( FiestaOnlineEditor * pge , std : : string windowTitle , vi2d pos , vi2d size , bool reloadImages )
: Window ( pge , windowTitle , pos , size ) , reloadImages ( reloadImages ) { }
ItemEditor : : ~ ItemEditor ( ) { } ;
void ItemEditor : : Load ( std : : string basePath , std : : string clientPath ) {
void ItemEditor : : Load ( std : : string basePath , std : : string clientPath , std : : string imageMagickPath ) {
ItemInfo . Load ( basePath + " /ItemInfo.shn " ) ;
ItemInfoServer . Load ( basePath + " /ItemInfoServer.shn " ) ;
ItemViewInfo . Load ( basePath + " /View/ItemViewInfo.shn " ) ;
GradeItemOption . Load ( basePath + " /GradeItemOption.shn " ) ;
for ( int i = 0 ; i < ItemInfo . Rows ( ) ; i + + ) {
Item it ;
it . id = ItemInfo . Get < uint16_t > ( i , 0 ) ;
@ -48,9 +49,76 @@ void ItemEditor::Load(std::string basePath,std::string clientPath){
it . useClass = Class ( ItemInfo . Get < uint32_t > ( i , 31 ) ) ;
it . buyPrice = Money ( ItemInfo . Get < uint32_t > ( i , 32 ) ) ;
it . sellPrice = Money ( ItemInfo . Get < uint32_t > ( i , 33 ) ) ;
it . enhanceLimit = ItemInfo . Get < uint32_t > ( i , 40 ) ;
it . enhanceLimit = ItemInfo . Get < byte > ( i , 40 ) ;
it . blockRate = ItemInfo . Get < uint32_t > ( i , 46 ) ;
itemList [ it . id ] = it ;
itemList [ it . inxName ] = it ;
}
for ( int i = 0 ; i < ItemInfoServer . Rows ( ) ; i + + ) {
std : : string index = ItemInfoServer . Get < std : : string > ( i , 1 ) ;
Item & it = itemList [ index ] ;
it . DropGroupA = ItemInfoServer . Get < std : : string > ( i , 4 ) ;
it . DropGroupB = ItemInfoServer . Get < std : : string > ( i , 5 ) ;
it . RandomOptionDrop = ItemInfoServer . Get < std : : string > ( i , 6 ) ;
it . vanishTime = ItemInfoServer . Get < uint32_t > ( i , 7 ) ;
it . lootingTime = ItemInfoServer . Get < uint32_t > ( i , 8 ) ;
it . slot = EquipSlot ( ItemInfoServer . Get < uint32_t > ( i , 11 ) ) ;
}
for ( int i = 0 ; i < ItemViewInfo . Rows ( ) ; i + + ) {
std : : string index = ItemViewInfo . Get < std : : string > ( i , 1 ) ;
Item & it = itemList [ index ] ;
it . iconIndex = ItemViewInfo . Get < uint32_t > ( i , 2 ) ;
std : : string iconFilename = ItemViewInfo . Get < std : : string > ( i , 3 ) ;
auto GetImage = [ & ] ( std : : string filename ) {
if ( imgLookup . count ( filename ) = = 0 ) {
std : : string basePath = clientPath + " /resmenu/Icon/ " ;
if ( reloadImages ) {
std : : string baseCmd = " \" " + imageMagickPath + " \" " + basePath + filename + " .dds " + basePath + filename + " .png " ;
std : : system ( baseCmd . c_str ( ) ) ;
}
imgLookup [ filename ] = std : : make_unique < Renderable > ( ) ;
imgLookup [ filename ] - > Load ( basePath + filename + " .png " ) ;
}
return imgLookup [ filename ] . get ( ) ;
} ;
it . icon = GetImage ( iconFilename ) ;
it . subIconIndex = ItemViewInfo . Get < uint32_t > ( i , 4 ) ;
std : : string subIconFilename = ItemViewInfo . Get < std : : string > ( i , 5 ) ;
if ( subIconFilename ! = " - " ) {
it . subIcon = GetImage ( subIconFilename ) ;
}
uint32_t r = ItemViewInfo . Get < uint32_t > ( i , 8 ) ;
uint32_t g = ItemViewInfo . Get < uint32_t > ( i , 9 ) ;
uint32_t b = ItemViewInfo . Get < uint32_t > ( i , 10 ) ;
it . borderCol = { uint8_t ( r ) , uint8_t ( g ) , uint8_t ( b ) } ;
uint32_t blend_r = ItemViewInfo . Get < uint32_t > ( i , 11 ) ;
uint32_t blend_g = ItemViewInfo . Get < uint32_t > ( i , 12 ) ;
uint32_t blend_b = ItemViewInfo . Get < uint32_t > ( i , 13 ) ;
it . blendCol = { uint8_t ( blend_r ) , uint8_t ( blend_g ) , uint8_t ( blend_b ) } ;
it . itemSize = ItemViewInfo . Get < float > ( i , 19 ) ;
it . description = ItemViewInfo . Get < std : : string > ( i , 26 ) ;
}
for ( int i = 0 ; i < GradeItemOption . Rows ( ) ; i + + ) {
std : : string index = GradeItemOption . Get < std : : string > ( i , 0 ) ;
Item & it = itemList [ index ] ;
it . stat_str = GradeItemOption . Get < uint16_t > ( i , 1 ) ;
it . stat_end = GradeItemOption . Get < uint16_t > ( i , 2 ) ;
it . stat_dex = GradeItemOption . Get < uint16_t > ( i , 3 ) ;
it . stat_int = GradeItemOption . Get < uint16_t > ( i , 4 ) ;
it . stat_spr = GradeItemOption . Get < uint16_t > ( i , 5 ) ;
it . resistPoison = GradeItemOption . Get < uint16_t > ( i , 6 ) ;
it . resistDisease = GradeItemOption . Get < uint16_t > ( i , 7 ) ;
it . resistCurse = GradeItemOption . Get < uint16_t > ( i , 8 ) ;
it . hitRatePctModifier = GradeItemOption . Get < uint16_t > ( i , 10 ) ;
it . blockRatePctModifier = GradeItemOption . Get < uint16_t > ( i , 11 ) ;
it . stat_hp = GradeItemOption . Get < uint16_t > ( i , 12 ) ;
it . stat_sp = GradeItemOption . Get < uint16_t > ( i , 13 ) ;
it . stat_dmg = GradeItemOption . Get < uint16_t > ( i , 14 ) ;
it . stat_magDmg = GradeItemOption . Get < uint16_t > ( i , 15 ) ;
}
}