pluginconfigemotesprofile.c 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. class PluginConfigEmotesProfile extends PluginConfigHandler
  2. {
  3. /*protected const string EMOTE_1 = "emote_slot_1";
  4. protected const string EMOTE_2 = "emote_slot_2";
  5. protected const string EMOTE_3 = "emote_slot_3";
  6. protected const string EMOTE_4 = "emote_slot_4";
  7. protected const string EMOTE_5 = "emote_slot_5";
  8. protected const string EMOTE_6 = "emote_slot_6";
  9. protected const string EMOTE_7 = "emote_slot_7";
  10. protected const string EMOTE_8 = "emote_slot_8";
  11. protected const string EMOTE_9 = "emote_slot_9";
  12. protected const string EMOTE_10 = "emote_slot_10";
  13. protected const string EMOTE_11 = "emote_slot_11";
  14. protected const string EMOTE_12 = "emote_slot_12";*/
  15. protected ref map<string, ref CfgParam> m_DefaultValues;
  16. protected ref TStringArray m_PresetList;
  17. //========================================
  18. // GetInstance
  19. //========================================
  20. static PluginConfigEmotesProfile GetInstance()
  21. {
  22. return PluginConfigEmotesProfile.Cast( GetPlugin(PluginConfigEmotesProfile) );
  23. }
  24. //========================================
  25. // GetCfgParamInt
  26. //========================================
  27. protected CfgParamInt GetNewCfgParamInt( int value )
  28. {
  29. CfgParamInt param = new CfgParamInt( "" );
  30. param.SetValue( value );
  31. return param;
  32. }
  33. //========================================
  34. // Int
  35. //========================================
  36. protected CfgParamInt SetInt( string key, int value )
  37. {
  38. CfgParamInt param = CfgParamInt.Cast( GetParamByName( key, CFG_TYPE_INT ) );
  39. param.SetValue( value );
  40. //SaveConfigToFile();
  41. return param;
  42. }
  43. protected int GetInt( string key )
  44. {
  45. if ( ParamExist(key) )
  46. {
  47. CfgParamInt param = CfgParamInt.Cast( GetParamByName( key, CFG_TYPE_INT ) );
  48. return param.GetValue();
  49. }
  50. else
  51. {
  52. if ( m_DefaultValues.Contains(key) )
  53. {
  54. CfgParamInt default_param = CfgParamInt.Cast( m_DefaultValues.Get( key ) );
  55. return SetInt( key, default_param.GetValue() ).GetValue();
  56. }
  57. else
  58. {
  59. return SetInt( key, 0 ).GetValue();
  60. }
  61. }
  62. }
  63. //========================================
  64. // PluginConfigEmotesProfile
  65. //========================================
  66. void PluginConfigEmotesProfile()
  67. {
  68. m_DefaultValues = new map<string, ref CfgParam>;
  69. //Here you can configure default EMOTES
  70. m_DefaultValues.Insert( EmoteSlots.EMOTE_1.ToString(), GetNewCfgParamInt(EmoteConstants.ID_EMOTE_GREETING) );
  71. m_DefaultValues.Insert( EmoteSlots.EMOTE_2.ToString(), GetNewCfgParamInt(EmoteConstants.ID_EMOTE_SOS) );
  72. m_DefaultValues.Insert( EmoteSlots.EMOTE_3.ToString(), GetNewCfgParamInt(EmoteConstants.ID_EMOTE_HEART) );
  73. m_DefaultValues.Insert( EmoteSlots.EMOTE_4.ToString(), GetNewCfgParamInt(EmoteConstants.ID_EMOTE_TAUNT) );
  74. m_DefaultValues.Insert( EmoteSlots.EMOTE_5.ToString(), GetNewCfgParamInt(EmoteConstants.ID_EMOTE_SURRENDER) );
  75. m_DefaultValues.Insert( EmoteSlots.EMOTE_6.ToString(), GetNewCfgParamInt(EmoteConstants.ID_EMOTE_TAUNTKISS) );
  76. m_DefaultValues.Insert( EmoteSlots.EMOTE_7.ToString(), GetNewCfgParamInt(EmoteConstants.ID_EMOTE_POINT) );
  77. m_DefaultValues.Insert( EmoteSlots.EMOTE_8.ToString(), GetNewCfgParamInt(EmoteConstants.ID_EMOTE_TAUNTELBOW) );
  78. m_DefaultValues.Insert( EmoteSlots.EMOTE_9.ToString(), GetNewCfgParamInt(EmoteConstants.ID_EMOTE_THUMB) );
  79. m_DefaultValues.Insert( EmoteSlots.EMOTE_10.ToString(), GetNewCfgParamInt(EmoteConstants.ID_EMOTE_THROAT) );
  80. m_DefaultValues.Insert( EmoteSlots.EMOTE_11.ToString(), GetNewCfgParamInt(EmoteConstants.ID_EMOTE_SUICIDE) );
  81. //m_DefaultValues.Insert( EMOTE_12, GetNewCfgParamInt(EmoteConstants.ID_EMOTE_DANCE) );
  82. //m_DefaultValues.Insert( EMOTE_12, GetNewCfgParamInt(EmoteConstants.ID_EMOTE_SOS) );
  83. }
  84. //========================================
  85. // GetFileName
  86. //========================================
  87. override string GetFileName()
  88. {
  89. return CFG_FILE_EMOTES_PROFILE;
  90. }
  91. //========================================
  92. // EmoteStoring
  93. //========================================
  94. int GetEmoteSlot1()
  95. {
  96. return GetInt( EmoteSlots.EMOTE_1.ToString() );
  97. }
  98. void SetEmoteSlot1( int emoted_id )
  99. {
  100. SetInt( EmoteSlots.EMOTE_1.ToString(), emoted_id );
  101. }
  102. int GetEmoteSlot2()
  103. {
  104. return GetInt( EmoteSlots.EMOTE_2.ToString() );
  105. }
  106. void SetEmoteSlot2( int emoted_id )
  107. {
  108. SetInt( EmoteSlots.EMOTE_2.ToString(), emoted_id );
  109. }
  110. int GetEmoteSlot3()
  111. {
  112. return GetInt( EmoteSlots.EMOTE_3.ToString() );
  113. }
  114. void SetEmoteSlot3( int emoted_id )
  115. {
  116. SetInt( EmoteSlots.EMOTE_3.ToString(), emoted_id );
  117. }
  118. int GetEmoteSlot4()
  119. {
  120. return GetInt( EmoteSlots.EMOTE_4.ToString() );
  121. }
  122. void SetEmoteSlot4( int emoted_id )
  123. {
  124. SetInt( EmoteSlots.EMOTE_4.ToString(), emoted_id );
  125. }
  126. int GetEmoteSlot5()
  127. {
  128. return GetInt( EmoteSlots.EMOTE_5.ToString() );
  129. }
  130. void SetEmoteSlot5( int emoted_id )
  131. {
  132. SetInt( EmoteSlots.EMOTE_5.ToString(), emoted_id );
  133. }
  134. int GetEmoteSlot6()
  135. {
  136. return GetInt( EmoteSlots.EMOTE_6.ToString() );
  137. }
  138. void SetEmoteSlot6( int emoted_id )
  139. {
  140. SetInt( EmoteSlots.EMOTE_6.ToString(), emoted_id );
  141. }
  142. int GetEmoteSlot7()
  143. {
  144. return GetInt( EmoteSlots.EMOTE_7.ToString() );
  145. }
  146. void SetEmoteSlot7( int emoted_id )
  147. {
  148. SetInt( EmoteSlots.EMOTE_7.ToString(), emoted_id );
  149. }
  150. int GetEmoteSlot8()
  151. {
  152. return GetInt( EmoteSlots.EMOTE_8.ToString() );
  153. }
  154. void SetEmoteSlot8( int emoted_id )
  155. {
  156. SetInt( EmoteSlots.EMOTE_8.ToString(), emoted_id );
  157. }
  158. int GetEmoteSlot9()
  159. {
  160. return GetInt( EmoteSlots.EMOTE_9.ToString() );
  161. }
  162. void SetEmoteSlot9( int emoted_id )
  163. {
  164. SetInt( EmoteSlots.EMOTE_9.ToString(), emoted_id );
  165. }
  166. int GetEmoteSlot10()
  167. {
  168. return GetInt( EmoteSlots.EMOTE_10.ToString() );
  169. }
  170. void SetEmoteSlot10( int emoted_id )
  171. {
  172. SetInt( EmoteSlots.EMOTE_10.ToString(), emoted_id );
  173. }
  174. int GetEmoteSlot11()
  175. {
  176. return GetInt( EmoteSlots.EMOTE_11.ToString() );
  177. }
  178. void SetEmoteSlot11( int emoted_id )
  179. {
  180. SetInt( EmoteSlots.EMOTE_11.ToString(), emoted_id );
  181. }
  182. /*int GetEmoteSlot12()
  183. {
  184. return GetInt( EMOTE_12 );
  185. }
  186. void SetEmoteSlot12( int emoted_id )
  187. {
  188. SetInt( EMOTE_12, emoted_id );
  189. }*/
  190. int GetEmoteFromSlot(string slot)
  191. {
  192. return GetInt( slot );
  193. }
  194. }
  195. enum EmoteSlots
  196. {
  197. EMOTE_1 = 1,
  198. EMOTE_2,
  199. EMOTE_3,
  200. EMOTE_4,
  201. EMOTE_5,
  202. EMOTE_6,
  203. EMOTE_7,
  204. EMOTE_8,
  205. EMOTE_9,
  206. EMOTE_10,
  207. EMOTE_11,
  208. EMOTE_12
  209. }