Counter-Strike: Global Offensive UserMessages

From AlliedModders Wiki
Revision as of 07:06, 20 December 2020 by Micapat (talk | contribs) (Add stock UnsignedFixed16ToFloat())
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Counter-Strike: Global Offensive uses Google's Protocol Buffers instead of Valve's traditional UserMessages.

The data on this page was read from [1]. The initial versions of these files were provided by Valve and updated by the AlliedModders staff.

//====== Copyright (c) 2013, Valve Corporation, All rights reserved. ========//
//
// Redistribution and use in source and binary forms, with or without 
// modification, are permitted provided that the following conditions are met:
//
// Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
// Redistributions in binary form must reproduce the above copyright notice, 
// this list of conditions and the following disclaimer in the documentation 
// and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 
// THE POSSIBILITY OF SUCH DAMAGE.
//===========================================================================//
//
// Purpose: The file defines our Google Protocol Buffers which are used in over 
// the wire messages for the Source engine.
//
//=============================================================================

VGUIMenu

Name: VGUIMenu.SubKey
Structure:
string name
string str


Name: VGUIMenu
Structure:
string name
bool show
repeated VGUIMenu.SubKey subkeys


Geiger

Name: Geiger
Structure:
int32 range


Train

Name: Train
Structure:
int32 train


HudText

Name: HudText
Structure:
string text


SayText

Name: SayText
Structure:
int32 ent_idx
string text
bool chat
bool textallchat


SayText2

Note: As of this writing, params requires four empty strings or it will crash the client

Name: SayText2
Structure:
int32 ent_idx
bool chat
string msg_name
repeated string params
bool textallchat


TextMsg

Name: TextMsg
Structure:
int32 msg_dst
repeated string params


HudMsg

Name: HudMsg
Structure:
int32 channel
CMsgVector2D pos
CMsgRGBA clr1
CMsgRGBA clr2
int32 effect
float fade_in_time
float fade_out_time
float hold_time
float fx_time
string text


Shake

Name: Shake
Structure:
int32 command
float local_amplitude
float frequency
float duration Time to shake (In seconds)


Shake.Command:

#define SHAKE_START            (0) // Starts the screen shake for all players within the radius
#define SHAKE_STOP             (1) // Stops the screen shake for all players within the radius
#define SHAKE_AMPLITUDE        (2) // Modifies the amplitude of an active screen shake for all players within the radius
#define SHAKE_FREQUENCY        (3) // Modifies the frequency of an active screen shake for all players within the radius
#define SHAKE_START_RUMBLEONLY (4) // Starts a shake effect that only rumbles the controller, no screen effect
#define SHAKE_START_NORUMBLE   (5) // Starts a shake that does NOT rumble the controller

Fade

Name: Fade
Structure:
int32 duration Time to fade in/out (In seconds)
int32 hold_time Time to hold the faded in/out state (In seconds)
int32 flags
CMsgRGBA clr


Fade.Duration:

Even if a 32 bits integer is requested, the value must be in Q7.9 format !

Fade.HoldTime:

Even if a 32 bits integer is requested, the value must be in Q7.9 format !

Fade.Flags:

#define FFADE_IN       (0x0001) // Fade in
#define FFADE_OUT      (0x0002) // Fade out
#define FFADE_MODULATE (0x0004) // Modulate (Don't blend)
#define FFADE_STAYOUT  (0x0008) // Ignores the duration, stays faded out until a new fade message is received
#define FFADE_PURGE    (0x0010) // Purges all other fades, replacing them with this one

Stocks:

#define CSGO_SCREENFADE_FRACTIONAL_BITS (9)
 
// ----------------------------------------------------------------
// Convert a float to an unsigned fixed 16 bits
// ----------------------------------------------------------------
stock int FloatToUnsignedFixed16(float input, int nb_fractional_bits)
{
    int output = RoundFloat(input * (1 << nb_fractional_bits));
 
    if (output < 0)     output = 0;
    if (output > 65535) output = 65535;
 
    return output;
}
 
// ----------------------------------------------------------------
// Convert an unsigned fixed 16 bits to a float
// ----------------------------------------------------------------
stock float UnsignedFixed16ToFloat(int input, int nb_fractional_bits)
{
    if (input < 0)     input = 0;
    if (input > 65535) input = 65535;
 
    return (float(input) / (1 << nb_fractional_bits));
}
 
// ----------------------------------------------------------------
// Fade the screen of a client
// ----------------------------------------------------------------
stock void CSGO_ScreenFadeClient(int clientIndex, float duration, float holdTime, int flags, int color[4])
{
    Protobuf message = UserMessageToProtobuf(StartMessageOne("Fade", clientIndex, USERMSG_RELIABLE));
 
    message.SetInt  ("duration",  FloatToUnsignedFixed16(duration, CSGO_SCREENFADE_FRACTIONAL_BITS));
    message.SetInt  ("hold_time", FloatToUnsignedFixed16(holdTime, CSGO_SCREENFADE_FRACTIONAL_BITS));
    message.SetInt  ("flags",     flags);
    message.SetColor("clr",       color);
 
    EndMessage();
}

Rumble

Name: Rumble
Structure:
int32 index
int32 data
int32 flags


Rumble.Index:

#define RUMBLE_INVALID                  (-1)
#define RUMBLE_STOP_ALL                 (0) // Cease all current rumbling effects.
#define RUMBLE_PISTOL                   (1)
#define RUMBLE_357                      (2)
#define RUMBLE_SMG1                     (3)
#define RUMBLE_AR2                      (4)
#define RUMBLE_SHOTGUN_SINGLE           (5)
#define RUMBLE_SHOTGUN_DOUBLE           (6)
#define RUMBLE_AR2_ALT_FIRE             (7)
#define RUMBLE_RPG_MISSILE              (8)
#define RUMBLE_CROWBAR_SWING            (9)
#define RUMBLE_AIRBOAT_GUN              (10)
#define RUMBLE_JEEP_ENGINE_LOOP         (11)
#define RUMBLE_FLAT_LEFT                (12)
#define RUMBLE_FLAT_RIGHT               (13)
#define RUMBLE_FLAT_BOTH                (14)
#define RUMBLE_DMG_LOW                  (15)
#define RUMBLE_DMG_MED                  (16)
#define RUMBLE_DMG_HIGH                 (17)
#define RUMBLE_FALL_LONG                (18)
#define RUMBLE_FALL_SHORT               (19)
#define RUMBLE_PHYSCANNON_OPEN          (20)
#define RUMBLE_PHYSCANNON_PUNT          (21)
#define RUMBLE_PHYSCANNON_LOW           (22)
#define RUMBLE_PHYSCANNON_MEDIUM        (23)
#define RUMBLE_PHYSCANNON_HIGH          (24)
#define RUMBLE_PORTALGUN_LEFT           (25)
#define RUMBLE_PORTALGUN_RIGHT          (26)
#define RUMBLE_PORTAL_PLACEMENT_FAILURE (27)

Rumble.Flags:

#define RUMBLE_FLAGS_NONE            (0x0000)
#define RUMBLE_FLAG_STOP             (0x0001) // Stop any instance of this type of effect that's already playing
#define RUMBLE_FLAG_LOOP             (0x0002) // Make this effect loop
#define RUMBLE_FLAG_RESTART          (0x0004) // If this effect is already playing, restart it
#define RUMBLE_FLAG_UPDATE_SCALE     (0x0008) // Apply DATA to this effect if already playing, but don't restart
#define RUMBLE_FLAG_ONLYONE          (0x0010) // Don't play this effect if it is already playing
#define RUMBLE_FLAG_RANDOM_AMPLITUDE (0x0020) // Amplitude scale will be randomly chosen (Between 10% and 100%)
#define RUMBLE_FLAG_INITIAL_SCALE    (0x0040) // Data is the initial scale to start this effect (* 100)

CloseCaption

Name: CloseCaption
Structure:
uint32 hash
int32 duration
bool from_player
string cctoken


CloseCaptionDirect

Name: CloseCaptionDirect
Structure:
uint32 hash
int32 duration
bool from_player


SendAudio

Name: SendAudio
Structure:
string radio_sound


RawAudio

Name: RawAudio
Structure:
int32 pitch
int32 ent_index
float duration
string voice_filename


VoiceMask

Name: VoiceMask.PlayerMask
Structure:
int32 game_rules_mask
int32 ban_masks


Name: VoiceMask
Structure:
repeated VoiceMask.PlayerMask player_masks
bool player_mod_enable


Damage

Name: Damage
Structure:
int32 amount
CMsgVector inflictor_world_pos
int32 victim_entindex


RadioText

Name: RadioText
Structure:
int32 msg_dst
int32 client
string msg_name
repeated string params


HintText

Name: HintText
Structure:
string text


KeyHintText

Name: KeyHintText
Structure:
string hints


ProcessSpottedEntityUpdate

Note: gurjeets - Message below is slightly bigger in size than the non-protobuf version, by around 8 bits.

Name: ProcessSpottedEntityUpdate.SpottedEntityUpdate
Structure:
int32 entity_idx
int32 class_id
int32 origin_x
int32 origin_y
int32 origin_z
int32 angle_y
bool defuser
bool player_has_defuser
bool player_has_c4


Name: ProcessSpottedEntityUpdate
Structure:
bool new_update
repeated ProcessSpottedEntityUpdate.SpottedEntityUpdate entity_updates


SendPlayerItemDrops

Name: SendPlayerItemDrops
Structure:
repeated ? entity_updates


SendPlayerItemFound

Name: SendPlayerItemFound
Structure:
? iteminfo
int32 entindex


RetakeUpdatePlayerCardList

Name: RetakeUpdatePlayerCardList
Structure:
bool defuse_kit
repeated int32 round_idx
repeated int32 loadout_idx
repeated int32 card_idx
repeated int32 type_idx
int32 mvp_boost_round_idx
int32 mvp_boost_loadout_idx
int32 mvp_boost_card_idx
int32 mvp_boost_extra_utility


RetakeUpdatePlayerCardSelection

Name: RetakeUpdatePlayerCardSelection
Structure:
int32 round_idx
int32 loadout_idx
int32 card_idx
int32 type_idx


ReloadEffect

Name: ReloadEffect
Structure:
int32 entidx
int32 actanim
float origin_x
float origin_y
float origin_z


WeaponSound

Name: WeaponSound
Structure:
int32 entidx
float origin_x
float origin_y
float origin_z
string sound
float timestamp


UpdateScreenHealthBar

Name: UpdateScreenHealthBar
Structure:
int32 entidx
float healthratio_old
float healthratio_new
int32 style


EntityOutlineHighlight

Name: EntityOutlineHighlight
Structure:
int32 entidx
bool removehighlight


AdjustMoney

Name: AdjustMoney
Structure:
int32 amount


ReportHit

Name: ReportHit
Structure:
float pos_x
float pos_y
float pos_z
float timestamp


KillCam

Name: KillCam
Structure:
int32 obs_mode
int32 first_target
int32 second_target


DesiredTimescale

Name: DesiredTimescale
Structure:
float desired_timescale
float duration_realtime_sec
int32 interpolator_type
float start_blend_time


CurrentTimescale

Name: CurrentTimescale
Structure:
float cur_timescale


AchievementEvent

Name: AchievementEvent
Structure:
int32 achievement
int32 count
int32 user_id


MatchEndConditions

Name: MatchEndConditions
Structure:
int32 fraglimit
int32 mp_maxrounds
int32 mp_winlimit
int32 mp_timelimit


PlayerStatsUpdate

Name: PlayerStatsUpdate.Stat
Structure:
int32 idx
int32 delta


Name: PlayerStatsUpdate
Structure:
int32 version
repeated PlayerStatsUpdate.Stat stats
int32 user_id
int32 crc


DisplayInventory

Name: DisplayInventory
Structure:
bool display
int32 user_id


QuestProgress

Name: QuestProgress
Structure:
uint32 quest_id
uint32 normal_points
uint32 bonus_points
bool is_event_quest


ScoreLeaderboardData

Name: ScoreLeaderboardData
Structure:
? data


PlayerDecalDigitalSignature

Name: PlayerDecalDigitalSignature
Structure:
? data


XRankGet

Note: Get ELO Rank Value from Client

Name: XRankGet
Structure:
int32 mode_idx
int32 controller


XRankUpd

Note: Update ELO Rank Value on Client

Name: XRankUpd
Structure:
int32 mode_idx
int32 controller
int32 ranking


CallVoteFailed

Name: CallVoteFailed
Structure:
int32 reason
int32 time


VoteStart

Name: VoteStart
Structure:
int32 team
int32 ent_idx
int32 vote_type
string disp_str
string details_str
string other_team_str
bool is_yes_no_vote
int32 entidx_target


VotePass

Name: VotePass
Structure:
int32 team
int32 vote_type
string disp_str
string details_str


VoteFailed

Name: VoteFailed
Structure:
int32 team
int32 reason


VoteSetup

Name: VoteSetup
Structure:
repeated string potential_issues


SendLastKillerDamageToClient

Name: SendLastKillerDamageToClient
Structure:
int32 num_hits_given
int32 damage_given
int32 num_hits_taken
int32 damage_taken


ServerRankUpdate

Name: ServerRankUpdate.RankUpdate
Structure:
int32 account_id
int32 rank_old
int32 rank_new
int32 num_wins
float rank_change
int32 rank_type_id


Name: ServerRankUpdate
Structure:
repeated ServerRankUpdate.RankUpdate rank_update


XpUpdate

Name: XpUpdate
Structure:
? data


ItemPickup

Name: ItemPickup
Structure:
string item


ShowMenu

Note: show hud menu

Name: ShowMenu
Structure:
int32 bits_valid_slots
int32 display_time
string menu_string


BarTime

Note: For the C4 progress bar

Name: BarTime
Structure:
string time


AmmoDenied

Name: AmmoDenied
Structure:
int32 ammoIdx


MarkAchievement

Name: MarkAchievement
Structure:
string achievement


MatchStatsUpdate

Name: MatchStatsUpdate
Structure:
string update


ItemDrop

Name: ItemDrop
Structure:
int64 itemid
bool death


GlowPropTurnOff

Name: GlowPropTurnOff
Structure:
int32 entidx


RoundBackupFilenames

Name: RoundBackupFilenames
Structure:
int32 count
int32 index
string filename
string nicename


SSUI

Name: SSUI
Structure:
bool show
float start_time
float end_time


SurvivalStats

Name: SurvivalStats.Fact
Structure:
int32 type
int32 display
int32 value
float interestingness


Name: SurvivalStats.Placement
Structure:
uint64 xuid
int32 teamnumber
int32 placement


Name: SurvivalStats.Damage
Structure:
uint64 xuid
int32 to
int32 to_hits
int32 from
int32 from_hits


Name: SurvivalStats
Structure:
uint64 xuid
repeated SurvivalStats.Fact facts
repeated SurvivalStats.Placement users
repeated SurvivalStats.Damage damages
int32 ticknumber


EndOfMatchAllPlayersData

Name: EndOfMatchAllPlayersData.Accolade
Structure:
int32 eaccolade
float value
int32 position


Name: EndOfMatchAllPlayersData.PlayerData
Structure:
int32 entindex
uint64 xuid
string name
int32 teamnumber
EndOfMatchAllPlayersData.Accolade nomination
repeated ? items
int32 playercolor
bool isbot


Name: EndOfMatchAllPlayersData
Structure:
repeated EndOfMatchAllPlayersData.PlayerData allplayerdata
int32 scene


RoundImpactScoreData

Name: RoundImpactScoreData.RisEvent.Victim
Structure:
int32 team_number
int32 entindex
uint64 xuid
int32 color
bool is_bot
bool is_dead


Name: RoundImpactScoreData.RisEvent.Objective
Structure:
int32 type


Name: RoundImpactScoreData.RisEvent.Damage
Structure:
int32 target_entindex
uint64 target_xuid
int32 health_removed
int32 num_hits
int32 return_health_removed
int32 num_return_hits


Name: RoundImpactScoreData.RisEvent
Structure:
float timestamp
int32 terrorist_odds
int32 ct_alive
int32 t_alive
RoundImpactScoreData.RisEvent.Victim victim_data
RoundImpactScoreData.RisEvent.Objective objective_data
repeated RoundImpactScoreData.RisEvent.Damage all_damage_data


Name: RoundImpactScoreData.InitialConditions
Structure:
int32 ct_equip_value
int32 t_equip_value
int32 terrorist_odds


Name: RoundImpactScoreData
Structure:
RoundImpactScoreData.InitialConditions init_conditions
repeated RoundImpactScoreData.RisEvent all_ris_event_data


CurrentRoundOdds

Name: CurrentRoundOdds
Structure:
int32 odds


DeepStats

Name: DeepStats
Structure:
? stats


ResetHud

Name: ResetHud
Structure:
bool reset


GameTitle

Name: GameTitle
Structure:
int32 dummy


RequestState

Name: RequestState
Structure:
int32 dummy


StopSpectatorMode

Name: StopSpectatorMode
Structure:
int32 dummy


DisconnectToLobby

Name: DisconnectToLobby
Structure:
int32 dummy


WarmupHasEnded

Name: WarmupHasEnded
Structure:
int32 dummy


ClientInfo

Name: ClientInfo
Structure:
int32 dummy


ServerRankRevealAll

Name: ServerRankRevealAll
Structure:
int32 seconds_till_shutdown
? reservation