////////////////////////////////////////
// WCS - Warcraft:Source              //
// ---------------------------------- //
//  by kRypT0n!Te                     //
//      http://wcs.despo-clan.de      //
// ---------------------------------- //
// Content of this subscript          //
// - ultimate, ability                //
// - death handling and skill exec    //
////////////////////////////////////////
// say commands:
// ability
//
// admin commands:
// wcs_deathhandle2 <userid>
// wcs_checkskills <userid> <skilltype>
// wcs_skillcheck <userid>
//
////////////////////////////////////////

block load
{
  es_xexists wcs_exists command ability
  es_xregclientcmd ultimate wcs/WCSfunctions/WCSskills/wcs_ultimate "Executes an ultimate skill"
  es_xregclientcmd ability wcs/WCSfunctions/WCSskills/wcs_ability "Command for special abilities"
  es es_xif (server_var(wcs_exists) = 0) then es_xregsaycmd ability wcs/WCSfunctions/WCSskills/wcs_ability "Command for special abilities"
  es_xexists wcs_exists command wcs_deathhandle2
  es es_xif (server_var(wcs_exists) = 0) then es_xregcmd wcs_deathhandle2 wcs/WCSfunctions/WCSskills/wcs_deathhandle2 "Cleanup events"
  es_xexists wcs_exists command wcs_checkskills
  es es_xif (server_var(wcs_exists) = 0) then es_xregcmd wcs_checkskills wcs/WCSfunctions/WCSskills/wcs_checkskills "wcs_checkskills - usage: wcs_checkskills <userid> <type>"
  es_xexists wcs_exists command wcs_skillcheck
  es es_xif (server_var(wcs_exists) = 0) then es_xregcmd wcs_skillcheck wcs/WCSfunctions/WCSskills/wcs_skillcheck "wcs_skillcheck - usage: wcs_skillcheck <userid>"

  es_xkeygroupcreate "WCSpha"
  es_xkeygroupcreate "WCSphv"
  es_xkeygroupcreate "WCSpd"
  es_xkeygroupcreate "WCSps"
  es_xkeygroupcreate "WCSpsay"
}

block unload
{
  es_xkeygroupdelete "WCSpha"
  es_xkeygroupdelete "WCSphv"
  es_xkeygroupdelete "WCSpd"
  es_xkeygroupdelete "WCSps"
  es_xkeygroupdelete "WCSpsay"
}

event player_disconnect
{
  es es_xexists wcs_exists key WCSpha event_var(userid)
  es es_xif (server_var(wcs_exists) = 1) then es_xkeydelete WCSpha event_var(userid)
  es es_xexists wcs_exists key WCSphv event_var(userid)
  es es_xif (server_var(wcs_exists) = 1) then es_xkeydelete WCSphv event_var(userid)
  es es_xexists wcs_exists key WCSpd event_var(userid)
  es es_xif (server_var(wcs_exists) = 1) then es_xkeydelete WCSpd event_var(userid)
  es es_xexists wcs_exists key WCSps event_var(userid)
  es es_xif (server_var(wcs_exists) = 1) then es_xkeydelete WCSps event_var(userid)
  es es_xexists wcs_exists key WCSpsay event_var(userid)
  es es_xif (server_var(wcs_exists) = 1) then es_xkeydelete WCSpsay event_var(userid)
}

event player_activate
{
  es es_xkeycreate WCSpha event_var(userid)
  es es_xkeycreate WCSphv event_var(userid)
  es es_xkeycreate WCSpd event_var(userid)
  es es_xkeycreate WCSps event_var(userid)
  es es_xkeycreate WCSpsay event_var(userid)
}

event server
{
  es_xkeygroupdelete "WCSpha"
  es_xkeygroupdelete "WCSphv"
  es_xkeygroupdelete "WCSpd"
  es_xkeygroupdelete "WCSps"
  es_xkeygroupdelete "WCSpsay"

  es_xkeygroupcreate "WCSpha"
  es_xkeygroupcreate "WCSphv"
  es_xkeygroupcreate "WCSpd"
  es_xkeygroupcreate "WCSps"
  es_xkeygroupcreate "WCSpsay"
}

block wcs_ultimate
{
es es_xif (server_var(wcs_debug) = 1) then profile begin ultimate
  // its a command
  es_xgetcmduserid wcs_userid
  es es_xexists wcs_exists userid server_var(wcs_userid)
  es_xsetinfo wcs_time 0
  es_xsetinfo wcs_curtime 0
  // prevent spectator running ultimate
  es_xsetinfo wcs_dead "1"
  es es_xgetplayerprop wcs_dead server_var(wcs_userid) "CCSPlayer.baseclass.pl.deadflag"
  es es_xif (server_var(wcs_dead) = "1") then es_xsetinfo wcs_exists 0
  es_xcopy wcs_ulti_allow wcs_gamestarted
  //es es_xif (server_var(wcs_game) != server_var(wcs_game_css)) then es_xsetinfo wcs_ulti_allow 1
  // check if its valid
  es es_xif (server_var(wcs_exists) = "1") do
  {
  	// check teams (T=2, CT=3), and ultimate protection in 30feet range
  	es es_xgetplayerteam wcs_team server_var(wcs_userid)
    es es_xif (server_var(wcs_team) = 2) then es_xsetinfo wcs_team_targetn "#c!d"
    es es_xif (server_var(wcs_team) = 3) then es_xsetinfo wcs_team_targetn "#t!d"
    es est_PlayerCount wcs_tmp server_var(wcs_team_targetn)
  	es es_xif (server_var(wcs_tmp) > 0) then est_Near wcs_uid server_var(wcs_team_targetn) 300 server_var(wcs_userid) "es_xsetinfo wcs_tmp 0;es es_xkeygetvalue wcs_tmp WCSuserdata server_var(wcs_uid) ulti_immunity;es es_xif (server_var(wcs_tmp) = 1) then es_xsetinfo wcs_ulti_allow 0"
    es es_xif (server_var(wcs_ulti_allow) = 1) do
    {
      // get a time
      es est_uptime wcs_curtime
      es_xsetinfo wcs_ulti 0
      es es_xkeygetvalue wcs_ulti WCSuserdata server_var(wcs_userid) "ultimate"
      es es_xif (server_var(wcs_ulti) = 0) do
      {
        es es_xkeysetvalue "WCSuserdata" server_var(wcs_userid) "ultimate" server_var(wcs_curtime)
        es es_xsetinfo wcs_ulti server_var(wcs_time)
      }
      es es_xmath wcs_time + server_var(wcs_curtime)
      es es_xmath wcs_time - server_var(wcs_ulti)
      es_xsetinfo wcs_ultidelay 0
      es_xsetinfo wcs_race 0
      es es_xkeygetvalue wcs_race "WCSuserdata" server_var(wcs_userid) "race"
      es es_xkeygetvalue wcs_ultidelay "WCSraces" server_var(wcs_race) "ultimate_cooldown"
      es est_IsNumeric wcs_numeric server_var(wcs_ultidelay)
      es es_xif (server_var(wcs_numeric) = "0") do
      {
      	es es_xkeygetvalue wcs_level "WCSuserdata" server_var(wcs_userid) "ultilevel"
        es es_xtoken wcs_ultidelay server_var(wcs_ultidelay) server_var(wcs_level) "|"
      }
      es es_xif (server_var(wcs_time) >= server_var(wcs_ultidelay)) do
      {
        es_xsetinfo wcs_ultinotexec 0
        // exec the skill
        es wcs_checkskills server_var(wcs_userid) "player_ultimate"
        // check if ultimate fails
        es es_xif (server_var(wcs_ultinotexec) = 0) then es_xkeysetvalue "WCSuserdata" server_var(wcs_userid) "ultimate" server_var(wcs_curtime)
      }
      es_xelse do
      {
        es es_xsetinfo wcs_diff server_var(wcs_ultidelay)
        es es_xmath wcs_diff - server_var(wcs_time)
        wcs_getlanguage "wcs_lng" "wcs_lng_cooldown"
        es es_xformat wcs_text server_var(wcs_lng) server_var(wcs_ultidelay) server_var(wcs_diff)
        es es_xtell server_var(wcs_userid) #multi server_var(wcs_text)
      }
    }
    es_xelse do
    {
    	wcs_getlanguage "wcs_lng" "wcs_lng_ultinotnow"
      es es_xtell server_var(wcs_userid) #multi server_var(wcs_lng)
    }
  }
es es_xif (server_var(wcs_debug) = 1) then profile end ultimate
}

block wcs_ability
{
es es_xif (server_var(wcs_debug) = 1) then profile begin ability
  // first, is it a custom command ?
  es_xsetinfo wcs_userid 0
  es_xgetargv wcs_userid 1
  es es_xexists wcs_exists userid server_var(wcs_userid)
  es es_xif (server_var(wcs_exists) = 0) do
  {
    // or a say command
    es_xgetcmduserid wcs_userid
    es es_xexists wcs_exists userid server_var(wcs_userid)
  }
  es es_xgetplayerprop wcs_dead server_var(wcs_userid) "CCSPlayer.baseclass.pl.deadflag"
  es es_xif (server_var(wcs_dead) = "1") then es_xsetinfo wcs_exists 0
  es_xcopy wcs_ulti_allow wcs_gamestarted
  //es es_xif (server_var(wcs_game) != server_var(wcs_game_css)) then es_xsetinfo wcs_ulti_allow 1
  es es_xif (server_var(wcs_ulti_allow) != "1") then es_xsetinfo wcs_exists 0
  es es_xif (server_var(wcs_exists) = 1) do
  {
    es es_xexists wcs_exists key WCSuserdata server_var(wcs_userid)
    es es_xif (server_var(wcs_exists) = 1) do
    {
      es es_xkeygetvalue wcs_tmp WCSuserdata server_var(wcs_userid) "ability"
      es es_xif (server_var(wcs_tmp) in "warden") do
      {
        es_xsetinfo wcs_ability_count 0
        es es_xkeygetvalue wcs_ability_count WCSuserdata server_var(wcs_userid) ability_count
        es es_xif (server_var(wcs_ability_count) > 0) do
        {
          es es_xif (server_var(wcs_tmp) = "warden") do
          {
            es_xsetinfo wcs_params 0
            es es_xkeygetvalue wcs_params WCSuserdata server_var(wcs_userid) "ability_parameter"
          	es es_xif (server_var(wcs_params) != "0") do
	          {
	          	es es_xgetplayerlocation wcs_x1 wcs_y1 wcs_z1 server_var(wcs_userid)
	          	es_xsetinfo wcs_duration 0
					    es es_xtoken wcs_duration server_var(wcs_params) 1 "_"
	          	es es_xif (server_var(wcs_graphicfx) = 1) do
	          	{
	          		es_xcopy wcs_x2 wcs_x1
					      es_xcopy wcs_y2 wcs_y1
					      es_xcopy wcs_z2 wcs_z1
					      es_xmath wcs_z1 + 120
				      	es est_Effect 11 #a 0 "sprites/purpleglow1.vmt" server_var(wcs_x1) server_var(wcs_y1) server_var(wcs_z1) server_var(wcs_duration) 2 50
				      	es est_Effect 3 #a 0 "sprites/lgtning.vmt" server_var(wcs_x1) server_var(wcs_y1) server_var(wcs_z1) server_var(wcs_x2) server_var(wcs_y2) server_var(wcs_z2) server_var(wcs_duration) 20 20 10 0 255 70
					      es_xmath wcs_z1 - 120
					    }
					    es es_xgetplayerteam wcs_team server_var(wcs_userid)
				      // check teams (T=2, CT=3)
	            es es_xif (server_var(wcs_team) = 2) do
	  					{
					    	es_xsetinfo wcs_team_target 3
					    	es_xsetinfo wcs_team_targetn "#ct"
					  	}
					  	es es_xif (server_var(wcs_team) = 3) do
					  	{
						    es_xsetinfo wcs_team_target 2
					    	es_xsetinfo wcs_team_targetn "#t"
					  	}
					  	es es_xtoken wcs_dmg server_var(wcs_params) 2 "_"
		          es es_xtoken wcs_radius server_var(wcs_params) 3 "_"
	          	es wcs_warden server_var(wcs_userid) server_var(wcs_duration) server_var(wcs_dmg) server_var(wcs_radius) server_var(wcs_team_target) server_var(wcs_team_targetn) server_var(wcs_x1) server_var(wcs_y1) server_var(wcs_z1) server_var(wcs_roundcounter)
	          	wcs_getlanguage "wcs_lng" "wcs_lng_wardencreated"
	          	es es_xtell server_var(wcs_userid) #multi server_var(wcs_lng)
	          }
          }
          es_xmath wcs_ability_count - 1
          es es_xkeysetvalue WCSuserdata server_var(wcs_userid) ability_count server_var(wcs_ability_count)
        }
        es_xelse do
        {
        	wcs_getlanguage "wcs_lng" "wcs_lng_noability"
        	es es_xtell server_var(wcs_userid) #multi server_var(wcs_lng)
        }
      }
    }
  }
es es_xif (server_var(wcs_debug) = 1) then profile end ability
}

block wcs_skillcheck
{
es es_xif (server_var(wcs_debug) = 1) then profile begin skillcheck
  // usage:    wcs_skillcheck <userid>
  // userid:   give a VALID userid
  es_xsetinfo wcs_scuserid 0
  es_xgetargv wcs_scuserid 1
  es es_xexists wcs_exists userid server_var(wcs_scuserid)
  es es_xif (server_var(wcs_exists) = 1) do
  {
    // reset all to 0
    es es_xkeysetvalue WCSuserdata server_var(wcs_scuserid) player_attacker 0
    es es_xkeysetvalue WCSuserdata server_var(wcs_scuserid) player_victim 0
    es es_xkeysetvalue WCSuserdata server_var(wcs_scuserid) player_death 0
    es es_xkeysetvalue WCSuserdata server_var(wcs_scuserid) player_spawn 0
    es es_xkeysetvalue WCSuserdata server_var(wcs_scuserid) player_say 0
    //ulti_immunity
    es_xsetinfo wcs_counter 1
    es es_xkeygetvalue wcs_race "WCSuserdata" server_var(wcs_scuserid) "race"
    es es_xkeygetvalue wcs_numberofskills "WCSraces" server_var(wcs_race) "numberofskills"
    es es_xif (server_var(wcs_debug) = 1) then profile begin skillcheck_a
    es es_xif (server_var(wcs_numberofskills) != 0) then while "server_var(wcs_counter) <= server_var(wcs_numberofskills)" "es es_xformat wcs_skillnumber skill_%1 server_var(wcs_counter);es es_xkeygetvalue wcs_skill WCSuserdata server_var(wcs_scuserid) server_var(wcs_skillnumber);es es_xkeygetvalue wcs_skilltype WCSraces server_var(wcs_race) skillcfg;es es_xtoken wcs_skilltype server_var(wcs_skilltype) server_var(wcs_counter) |;es es_xkeygetvalue wcs_tmp WCSuserdata server_var(wcs_scuserid) server_var(wcs_skilltype);es es_xif (server_var(wcs_skill) > 0) then es_xkeysetvalue WCSuserdata server_var(wcs_scuserid) server_var(wcs_skilltype) 1;es es_xif (server_var(wcs_skill) = 0) then es_xif (server_var(wcs_tmp) = 0) then es_xkeysetvalue WCSuserdata server_var(wcs_scuserid) server_var(wcs_skilltype) 0;es_xmath wcs_counter + 1"
    es es_xif (server_var(wcs_debug) = 1) then profile end skillcheck_a
    es es_xkeycreate WCSpha event_var(userid)
    es es_xkeycreate WCSphv event_var(userid)
    es es_xkeycreate WCSpd event_var(userid)
    es es_xkeycreate WCSps event_var(userid)
    es es_xkeycreate WCSpsay event_var(userid)
    es_xsetinfo wcs_counter 1
    es_xsetinfo wcs_itemactivate 0
    es es_xif (server_var(wcs_debug) = 1) then profile begin skillcheck_b
    while "server_var(wcs_counter) <= 5" "es_xdoblock wcs/WCSfunctions/WCSskills/wcs_skillcheck_b;es_xmath wcs_counter + 1;es es_xif (server_var(wcs_activate) = 1) then es_xsetinfo wcs_itemactivate 1"
    es es_xkeysetvalue WCSuserdata server_var(wcs_scuserid) "itemactivate" server_var(wcs_itemactivate)
    es es_xif (server_var(wcs_debug) = 1) then profile end skillcheck_b
  }
  es es_xif (server_var(wcs_debug) = 1) then profile end skillcheck
}

block wcs_skillcheck_a
{
	es es_xformat wcs_skillnumber "skill_%1" server_var(wcs_counter)
	es es_xkeygetvalue wcs_skill "WCSuserdata" server_var(wcs_scuserid) server_var(wcs_skillnumber)
	es es_xkeygetvalue wcs_skilltype "WCSraces" server_var(wcs_race) "skillcfg"
	es es_xtoken wcs_skilltype server_var(wcs_skilltype) server_var(wcs_counter) "|"
	es es_xkeygetvalue wcs_tmp "WCSuserdata" server_var(wcs_scuserid) server_var(wcs_skilltype)
	es es_xif (server_var(wcs_skill) > 0) then es_xkeysetvalue "WCSuserdata" server_var(wcs_scuserid) server_var(wcs_skilltype) "1"
	es es_xif (server_var(wcs_skill) = 0) then es_xif (server_var(wcs_tmp) = "0") then es_xkeysetvalue "WCSuserdata" server_var(wcs_scuserid) server_var(wcs_skilltype) "0"
}

block wcs_skillcheck_b
{
  es_xsetinfo wcs_activate 0
  es es_xtoken wcs_shopcat server_var(wcs_eventarray1) server_var(wcs_counter) "|"
  es es_xtoken wcs_eventcat server_var(wcs_eventarray2) server_var(wcs_counter) "|"
  es es_xkeygetvalue wcs_tmp server_var(wcs_shopcat) server_var(wcs_scuserid) "icmd1"
  es es_xstrlen wcs_strlen server_var(wcs_tmp)
  es es_xif (server_var(wcs_strlen) > 1) then es_xsetinfo wcs_activate 1
  es es_xkeygetvalue wcs_tmp server_var(wcs_shopcat) server_var(wcs_scuserid) "icmd2"
  es es_xstrlen wcs_strlen server_var(wcs_tmp)
  es es_xif (server_var(wcs_strlen) > 1) then es_xsetinfo wcs_activate 1
  es es_xkeygetvalue wcs_tmp server_var(wcs_shopcat) server_var(wcs_scuserid) "icmd3"
  es es_xstrlen wcs_strlen server_var(wcs_tmp)
  es es_xif (server_var(wcs_strlen) > 1) then es_xsetinfo wcs_activate 1
  es es_xkeygetvalue wcs_tmp "WCSuserdata" server_var(wcs_scuserid) server_var(wcs_eventcat)
  es es_xif (server_var(wcs_activate) = "1") then es_xkeysetvalue "WCSuserdata" server_var(wcs_scuserid) server_var(wcs_eventcat) "1"
  es es_xif (server_var(wcs_activate) = "0") then es_xif (server_var(wcs_tmp) = "0") then es_xkeysetvalue "WCSuserdata" server_var(wcs_scuserid) server_var(wcs_eventcat) "0"
}

block wcs_deathhandle2
{
  es_xsetinfo wcs_userid 0
  es_xgetargv wcs_userid 1
	// remove custom item events
	es es_xexists wcs_exists key WCSpha server_var(wcs_userid)
  es es_xif (server_var(wcs_exists) = 1) then es_xkeydelete WCSpha server_var(wcs_userid)
  es es_xexists wcs_exists key WCSphv server_var(wcs_userid)
  es es_xif (server_var(wcs_exists) = 1) then es_xkeydelete WCSphv server_var(wcs_userid)
  es es_xexists wcs_exists key WCSpd server_var(wcs_userid)
  es es_xif (server_var(wcs_exists) = 1) then es_xkeydelete WCSpd server_var(wcs_userid)
  es es_xexists wcs_exists key WCSps server_var(wcs_userid)
  es es_xif (server_var(wcs_exists) = 1) then es_xkeydelete WCSps server_var(wcs_userid)
  es es_xexists wcs_exists key WCSpsay server_var(wcs_userid)
  es es_xif (server_var(wcs_exists) = 1) then es_xkeydelete WCSpsay server_var(wcs_userid)
	es es_xkeycreate WCSpha server_var(wcs_userid)
  es es_xkeycreate WCSphv server_var(wcs_userid)
  es es_xkeycreate WCSpd server_var(wcs_userid)
  es es_xkeycreate WCSps server_var(wcs_userid)
  es es_xkeycreate WCSpsay server_var(wcs_userid)
  // clear item amount
  es es_xforeachval wcs_val in WCSuserdata server_var(wcs_userid) "es es_xif (item_ in server_var(wcs_val)) then es_xkeysetvalue WCSuserdata server_var(wcs_userid) server_var(wcs_val) 0"
}

block wcs_checkskills
{
es es_xif (server_var(wcs_debug) = 1) then profile begin checkskill
  // custom command
  es_xsetinfo wcs_userid 0
  es_xsetinfo wcs_checkskill 0
  es_xgetargv wcs_userid 1
  es_xgetargv wcs_checkskill 2
  es es_xexists wcs_exists userid server_var(wcs_userid)
  es es_xif (server_var(wcs_exists) = 1) do
  {
    es es_xif (server_var(wcs_checkskill) in "player_death player_attacker player_victim player_spawn player_say player_ultimate") do
    {
      es es_xexists wcs_exists key "WCSuserdata" server_var(wcs_userid)
      es es_xif (server_var(wcs_exists) = 1) do
      {
        es_xsetinfo wcs_race 0
        es es_xkeygetvalue wcs_race "WCSuserdata" server_var(wcs_userid) "race"
        es_xsetinfo wcs_level 0
        es_xsetinfo wcs_skill 0
        es_xsetinfo wcs_skillcfg 0
        es_xsetinfo wcs_skill_setting 0
        es_xsetinfo wcs_skill_cmd 0
        es_xsetinfo wcs_skill_sfx 0
        // new try
        es_xsetinfo wcs_numberofskills 0
        es_xsetinfo wcs_val 0
        es_xsetinfo wcs_skilltype 0
        es_xsetinfo wcs_scounter 1
        es es_xkeygetvalue wcs_numberofskills WCSraces server_var(wcs_race) "numberofskills"
        es es_xif (server_var(wcs_numberofskills) != "0") then while "server_var(wcs_scounter) <= server_var(wcs_numberofskills)" "es es_xformat wcs_val skill_%1 server_var(wcs_scounter);es es_xkeygetvalue wcs_skilltype WCSraces server_var(wcs_race) skillcfg;es es_xtoken wcs_skilltype server_var(wcs_skilltype) server_var(wcs_scounter) |;es es_xif (server_var(wcs_skilltype) = server_var(wcs_checkskill)) then es_xdoblock wcs/WCSfunctions/WCSskills/wcs_execskills;es_xmath wcs_scounter + 1"
      }
    }
  }
es es_xif (server_var(wcs_debug) = 1) then profile end checkskill
}

block wcs_execskills
{
es es_xif (server_var(wcs_debug) = 1) then profile begin execskill
  es es_xexists wcs_exists userid server_var(wcs_userid)
  // no skills while spectator/invalid team
  es_xsetinfo wcs_team 0
  es es_xgetplayerteam wcs_team server_var(wcs_userid)
  es es_xif (server_var(wcs_team) <= 1) then es_xsetinfo wcs_exists "0"
  es es_xif (server_var(wcs_exists) = 1) do
  {
    es es_xif (server_var(wcs_val) != "0") do
    {
      // get skill level
      es_xsetinfo wcs_level 0
      es es_xkeygetvalue wcs_level "WCSuserdata" server_var(wcs_userid) server_var(wcs_val)
      // if level > 0 get the config type
      es es_xif (server_var(wcs_level) > 0) do
      {
        // raceX_skillY -> get Y (skill number)
        //es es_xtoken wcs_skill server_var(wcs_val) 2 "skill"
        es es_xsetinfo wcs_skill server_var(wcs_scounter)
        // check if the config is equal
        es es_xkeygetvalue wcs_skillcfg "WCSraces" server_var(wcs_race) "skillcfg"
        es es_xtoken wcs_skillcfg server_var(wcs_skillcfg) server_var(wcs_skill) "|"
        es es_xif (server_var(wcs_skillcfg) = server_var(wcs_checkskill)) do
        {
es es_xif (server_var(wcs_debug) = "1") then echo running race server_var(wcs_race) -> skill server_var(wcs_skill) 
          // get the settings
          es es_xformat wcs_skill_setting "skill%1_setting" server_var(wcs_skill)
          es es_xformat wcs_skill_cmd "skill%1_cmd" server_var(wcs_skill)
          es es_xformat wcs_skill_sfx "skill%1_sfx" server_var(wcs_skill)
          es es_xkeygetvalue wcs_skill_setting WCSraces server_var(wcs_race) server_var(wcs_skill_setting)
          es es_xtoken wcs_skill_setting server_var(wcs_skill_setting) server_var(wcs_level) "|"
          es es_xkeygetvalue wcs_skill_cmd WCSraces server_var(wcs_race) server_var(wcs_skill_cmd)
          es es_xkeygetvalue wcs_skill_sfx WCSraces server_var(wcs_race) server_var(wcs_skill_sfx)
          // roll the dice
          es_xrand wcs_dice 1 100
es es_xif (server_var(wcs_debug) = "1") then echo WCS : Dice rolled server_var(wcs_dice)
          es es_xstrlen wcs_strlen server_var(wcs_skill_setting)
          // execute the skill
          es es_xif (server_var(wcs_strlen) > 1) do
          {
            es alias wcs_cmd server_var(wcs_skill_setting)
            wcs_cmd
          }
          es es_xstrlen wcs_strlen server_var(wcs_skill_sfx)
          es es_xif (server_var(wcs_strlen) > 1) do
          {
            es es_xif (server_var(wcs_graphicfx) = "1") do
            {
              es_xsetinfo wcs_dead "1"
              es es_xgetplayerprop wcs_dead server_var(wcs_userid) "CCSPlayer.baseclass.pl.deadflag"
              es es_xif (server_var(wcs_dead) = "0") do
              {
                es alias wcs_cmd server_var(wcs_skill_sfx)
                wcs_cmd
              }
            }
          }
          es es_xstrlen wcs_strlen server_var(wcs_skill_cmd)
          es es_xif (server_var(wcs_strlen) > 1) do
          {
            es alias wcs_cmd server_var(wcs_skill_cmd)
            es es_xif (server_var(wcs_graphicfx) = "1") then es_xif (server_var(wcs_cfg_skillflash) = "1") then est_fade server_var(wcs_userid) 0 0.3 0 255 255 255 100
            wcs_cmd
          }
        }
      }
    }
  }
es es_xif (server_var(wcs_debug) = 1) then profile end execskill
}
