Documentation ¶
Overview ¶
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Index ¶
- Constants
- func ClaimAliasesByPlayer(store store.DBConn, player uint, aliases []string)
- func CreateSchema(store store.DBConn) error
- func HasPlayer(store store.DBConn, name string) bool
- func HasPlayerId(store store.DBConn, pid uint) bool
- func ItemHasDuration(itype string) bool
- func NewAliasOrCurrent(store store.DBConn, newalias Alias) uint
- func NewItemStat(store store.DBConn, is ItemStat) uint
- func NewMatch(store store.DBConn, match Match) uint
- func NewMatchInfo(store store.DB, m *MatchInfo) (uint, string)
- func NewPlayer(store store.DBConn, name string, passwordhash string) uint
- func NewPlayerMatchStat(store store.DBConn, pms PlayerMatchStat) uint
- func NewWeaponStat(store store.DBConn, ws WeaponStat) uint
- type Alias
- type DescData
- type GlobalStats
- type ItemDesc
- type ItemStat
- type Match
- type MatchInfo
- type MatchListParams
- type Player
- type PlayerDataItem
- type PlayerGlobalStats
- type PlayerMatchStat
- type WeaponStat
Constants ¶
const ( // for sake of simplicity define item types using names // matching data coming from CPMA Q3 server RedArmor = "RA" YellowArmor = "YA" GreenArmor = "GA" MegaHealth = "MH" QuadDamage = "Quad" BattleSuit = "BattleSuit" Regeneration = "Regen" Haste = "Haste" Flight = "Flight" Invisibility = "Invis" // weapons Gauntlet = "G" Machinegun = "MG" Shotgun = "SG" Plasmagun = "PG" GrenadeLauncher = "GL" RocketLauncher = "RL" Railgun = "RG" BFG = "BFG" LightningGun = "LG" )
const (
NoUser = 0
)
Variables ¶
This section is empty.
Functions ¶
func ClaimAliasesByPlayer ¶
func CreateSchema ¶
func ItemHasDuration ¶
returns true if effects of given item are time bounded
func NewAliasOrCurrent ¶
create or lookup a matching alias and return its ID
func NewItemStat ¶
create new item stat and return its ID
func NewMatchInfo ¶
load user provided matchinfo into store, returns match ID and hash
func NewPlayerMatchStat ¶
func NewPlayerMatchStat(store store.DBConn, pms PlayerMatchStat) uint
func NewWeaponStat ¶
func NewWeaponStat(store store.DBConn, ws WeaponStat) uint
create new weapon stat and return its ID
Types ¶
type Alias ¶
type Alias struct { gorm.Model // alias, ex. 'honeybunny', 'Klesk' Alias string // player claiming this alias PlayerID uint }
Alias is a nickname used during the match.
type GlobalStats ¶
type GlobalStats struct { // total number of frags/kills Frags uint // total number of suicides Suicides uint // total number of matches Matches uint // total number of unique maps Maps uint // number of rockets launched RocketsLaunched uint // players Players uint }
func GetGlobalStats ¶
func GetGlobalStats(store store.DB) GlobalStats
type ItemDesc ¶
type ItemDesc struct { // short name, ex. RA (red armor), RL (rocket launcher) Short string // long name - Rocket Launcher Name string }
item (such as rocket launcher, railgun, red armor) descriptor
type ItemStat ¶
type ItemStat struct { gorm.Model // item type (RA, YA, GA, MH) Type string // pickups count Pickups uint // time held (when applicable, ex. for quad) Time time.Duration // player's match stats this item is part of PlayerMatchStatID uint }
Per item statistics achieved during the match
func ListItemStats ¶
list weapon statistics for given player match stat ID
func (ItemStat) DurationDesc ¶
func (ItemStat) HasDuration ¶
true if effect of given item is time bounded, such as Quad Damage, Regeneration, Battle Suit
type Match ¶
type Match struct { gorm.Model // match data hash DataHash string `sql:"not null,unique"` // when the match was played DateTime time.Time // duration in seconds Duration uint // map, ex. q3dm17 Map string // type of match, 1v1, FFA, CTF Type string }
Match data
func ListMatches ¶
func ListMatches(store store.DBConn, params MatchListParams) []Match
func (Match) DurationDesc ¶
func (Match) NiceDateTime ¶
type MatchInfo ¶
type MatchInfo struct { Match Match // stats of all players who attended this match PlayerData []PlayerDataItem }
aggregate match info
type MatchListParams ¶
type Player ¶
type Player struct { gorm.Model // user defined name, ex. joe Name string // password hash PasswordHash string }
Registered players
func ListPlayers ¶
type PlayerDataItem ¶
type PlayerDataItem struct { // use Alias to access PlayerID Alias Alias Weapons []WeaponStat Items []ItemStat Stats PlayerMatchStat }
aggregate player data from particular match
type PlayerGlobalStats ¶
type PlayerGlobalStats struct { Kills uint Deaths uint Suicides uint Matches uint KillsPerMatch float32 // frags per life Efficiency float32 Wins uint // global weapon stats Weapons []WeaponStat // global item stats Items []ItemStat }
func GetPlayerGlobaStats ¶
func GetPlayerGlobaStats(store store.DB, player uint) *PlayerGlobalStats
type PlayerMatchStat ¶
type PlayerMatchStat struct { gorm.Model // score Score int // kills count Kills int // number of deaths Deaths int // self-kills count Suicides int // net (kills - deaths - suicides) Net int // damage given in HP DamageGiven int // damage taken in HP DamageTaken int // total health taken in HP HealthTotal int // total armor points ArmorTotal int // alias used AliasID uint // match MatchID uint }
Overall statistics achieved by player during a match
func ListPlayerMatchStat ¶
func ListPlayerMatchStat(store store.DBConn, matchID uint) []PlayerMatchStat
type WeaponStat ¶
type WeaponStat struct { gorm.Model // weapon type Type string // number of hits Hits uint // number of shots Shots uint // number of kills Kills uint // player's match stats this weapon is part of PlayerMatchStatID uint }
Per weapon statistics achieved during the match
func ListWeaponStats ¶
func ListWeaponStats(store store.DBConn, pmsID uint) []WeaponStat
list weapon statistics for given player match stat ID
func (WeaponStat) Accuracy ¶
func (w WeaponStat) Accuracy() uint
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |