////////////////////////////////////////////////////////////////////////////// // // File : k_inc_block.skrit // Author(s): Witness (Lisa Hui) // Purpose : utility functions for blocking equip slots in conjunction with // character.skrit, equip_block.skrit and job_get.skrit // History : v1.0 [November 6, 2004] // //---------------------------------------------------------------------------- // Version: 1.0 Date: November 6, 2004 //---------------------------------------------------------------------------- ////////////////////////////////////////////////////////////////////////////// bool IsBlockedSlot$( Go user$, Go item$ ) { if ( !user$.HasComponent( "player_custom" ) ) { return false; } eEquipSlot es$ = item$.Gui.EquipSlot; if ( es$ < 0 || es$ > 5 ) { return false; } if ( es$ == ES_CHEST ) { return ( user$.GetComponentInt( "player_custom", "block_es_chest", 0 ) > 0 ); } if ( es$ == ES_FEET ) { return ( user$.GetComponentInt( "player_custom", "block_es_feet", 0 ) > 0 ); } if ( es$ == ES_FOREARMS ) { return ( user$.GetComponentInt( "player_custom", "block_es_forearms", 0 ) > 0 ); } if ( es$ == ES_HEAD ) { return ( user$.GetComponentInt( "player_custom", "block_es_head", 0 ) > 0 ); } if ( es$ == ES_WEAPON_HAND ) { return ( user$.GetComponentInt( "player_custom", "block_es_melee", 0 ) > 0 ); } if ( es$ == ES_SHIELD_HAND ) { if ( item$.IsRangedWeapon() ) { return ( user$.GetComponentInt( "player_custom", "block_es_ranged", 0 ) > 0 ); } return ( user$.GetComponentInt( "player_custom", "block_es_shield", 0 ) > 0 ); } return false; } void BlockSlot$( string equip_window$, string equip_rect$, string ghost_window$, string ghost_rect$ ) { //report.screenf("Blocking equip window %s",equip_window$); UIWindow slot$ = UIShell.FindUIWindow( equip_window$, "character" ); slot$.Alpha = 0.3; slot$.Consumable = false; slot$.Enabled = false; slot$.InputType = TYPE_INPUT_NONE; slot$.Type = UI_TYPE_WINDOW; if ( equip_rect$ != "" ) { if ( StringTool.GetNumDelimitedValues( equip_rect$, ',' ) == 4 ) { slot$.SetRect( StringTool.GetDelimitedInt( equip_rect$, 0, ',', 0 ), //left StringTool.GetDelimitedInt( equip_rect$, 2, ',', 0 ), //right StringTool.GetDelimitedInt( equip_rect$, 1, ',', 0 ), //top StringTool.GetDelimitedInt( equip_rect$, 3, ',', 0 ), //bottom false ); } } if ( ghost_window$ != "" ) { slot$ = UIShell.FindUIWindow( ghost_window$, "character" ); slot$.Alpha = 0.0; if ( ghost_rect$ != "" ) { if ( StringTool.GetNumDelimitedValues( ghost_rect$, ',' ) == 4 ) { slot$.SetRect( StringTool.GetDelimitedInt( ghost_rect$, 0, ',', 0 ), //left StringTool.GetDelimitedInt( ghost_rect$, 2, ',', 0 ), //right StringTool.GetDelimitedInt( ghost_rect$, 1, ',', 0 ), //top StringTool.GetDelimitedInt( ghost_rect$, 3, ',', 0 ), //bottom false ); } } } } void UnblockSlot$( string equip_window$, string equip_rect$, string ghost_window$, string ghost_rect$ ) { //report.screenf("Unblocking equip window %s",equip_window$); UIWindow slot$ = UIShell.FindUIWindow( equip_window$, "character" ); slot$.Alpha = 1.0; slot$.Consumable = true; slot$.Enabled = true; slot$.InputType = TYPE_INPUT_MOUSE; slot$.Type = UI_TYPE_ITEMSLOT; if ( equip_rect$ != "" ) { if ( StringTool.GetNumDelimitedValues( equip_rect$, ',' ) == 4 ) { slot$.SetRect( StringTool.GetDelimitedInt( equip_rect$, 0, ',', 0 ), //left StringTool.GetDelimitedInt( equip_rect$, 2, ',', 0 ), //right StringTool.GetDelimitedInt( equip_rect$, 1, ',', 0 ), //top StringTool.GetDelimitedInt( equip_rect$, 3, ',', 0 ), //bottom false ); } } if ( ghost_window$ != "" ) { slot$ = UIShell.FindUIWindow( ghost_window$, "character" ); slot$.Alpha = 1.0; if ( ghost_rect$ != "" ) { if ( StringTool.GetNumDelimitedValues( ghost_rect$, ',' ) == 4 ) { slot$.SetRect( StringTool.GetDelimitedInt( ghost_rect$, 0, ',', 0 ), //left StringTool.GetDelimitedInt( ghost_rect$, 2, ',', 0 ), //right StringTool.GetDelimitedInt( ghost_rect$, 1, ',', 0 ), //top StringTool.GetDelimitedInt( ghost_rect$, 3, ',', 0 ), //bottom false ); } } } } void BlockEquipSlot$( Go user$, string block_slot$ ) { if ( !user$.HasComponent( "player_custom" ) ) { return; } int block_count$ = user$.GetComponentInt( "player_custom", block_slot$, 0 ); block_count$ += 1; user$.SetComponentInt( "player_custom", block_slot$, block_count$ ); } void UnblockEquipSlot$( Go user$, string block_slot$ ) { if ( !user$.HasComponent( "player_custom" ) ) { return; } int block_count$ = user$.GetComponentInt( "player_custom", block_slot$, 0 ); block_count$ -= 1; user$.SetComponentInt( "player_custom", block_slot$, block_count$ ); }