当前位置: 首页>>代码示例>>Golang>>正文


Golang QTPacket.ReadUint8方法代码示例

本文整理汇总了Golang中Network.QTPacket.ReadUint8方法的典型用法代码示例。如果您正苦于以下问题:Golang QTPacket.ReadUint8方法的具体用法?Golang QTPacket.ReadUint8怎么用?Golang QTPacket.ReadUint8使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Network.QTPacket的用法示例。


在下文中一共展示了QTPacket.ReadUint8方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: NewShallowShownPokeFromPacket

func NewShallowShownPokeFromPacket(_packet *pnet.QTPacket) *ShallowShownPoke {
	shallowShownPoke := ShallowShownPoke{UID: NewUniqueIdFromPacket(_packet),
		Level:  int(_packet.ReadUint8()),
		Gender: int(_packet.ReadUint8()),
		Item:   _packet.ReadBool()}
	return &shallowShownPoke
}
开发者ID:gasperko,项目名称:pokemon-universe,代码行数:7,代码来源:shallowshownpoke.go

示例2: NewTeamPokeFromPacket

func NewTeamPokeFromPacket(_packet *pnet.QTPacket) *TeamPoke {
	teamPoke := TeamPoke{}
	teamPoke.UID = NewUniqueIdFromPacket(_packet)
	teamPoke.Nick = _packet.ReadString()
	teamPoke.Item = int(_packet.ReadUint16())
	teamPoke.Ability = int(_packet.ReadUint16())
	teamPoke.Nature = int(_packet.ReadUint8())
	teamPoke.Gender = int(_packet.ReadUint8())
	// teamPoke.Gen = (int)_packet.ReadByte()
	teamPoke.Shiny = _packet.ReadBool()
	teamPoke.Happiness = int(_packet.ReadUint8())
	teamPoke.Level = int(_packet.ReadUint8())

	teamPoke.Moves = make([]int, 4)
	for i := 0; i < 4; i++ {
		teamPoke.Moves[i] = int(_packet.ReadUint32())
	}
	teamPoke.DVs = make([]int, 6)
	for i := 0; i < 6; i++ {
		teamPoke.DVs[i] = int(_packet.ReadUint8())
	}
	teamPoke.EVs = make([]int, 6)
	for i := 0; i < 6; i++ {
		teamPoke.EVs[i] = int(_packet.ReadUint8())
	}

	return &teamPoke
}
开发者ID:gasperko,项目名称:pokemon-universe,代码行数:28,代码来源:teampoke.go

示例3: NewBattleMoveFromPacket

func NewBattleMoveFromPacket(_packet *pnet.QTPacket) *BattleMove {
	battleMove := NewBattleMoveFromId(int(_packet.ReadUint16()))
	battleMove.CurrentPP = int(_packet.ReadUint8())
	battleMove.TotalPP = int(_packet.ReadUint8())

	return battleMove
}
开发者ID:gasperko,项目名称:pokemon-universe,代码行数:7,代码来源:battlemove.go

示例4: receivedStatusMessage

func (b *Battle) receivedStatusMessage(_packet *pnet.QTPacket, _player int) {
	status := int(_packet.ReadUint8())
	var statusStr string
	switch status {
	case STATUSFEELING_FEELCONFUSION:
		statusStr = fmt.Sprintf("%s is confused!\n", b.currentPoke(_player))
	case STATUSFEELING_HURTCONFUSION:
		statusStr = "It hurt itself in its confusion!\n"
	case STATUSFEELING_FREECONFUSION:
		statusStr = fmt.Sprintf("%s snapped out of its confusion!\n", b.currentPoke(_player))
	case STATUSFEELING_PREVPARALYSED:
		statusStr = fmt.Sprintf("%s is paralyzed! It can't move!\n", b.currentPoke(_player))
	case STATUSFEELING_FEELASLEEP:
		statusStr = fmt.Sprintf("%s is fast asleep!\n", b.currentPoke(_player))
	case STATUSFEELING_FREEASLEEP:
		statusStr = fmt.Sprintf("%s woke up!\n", b.currentPoke(_player))
	case STATUSFEELING_HURTBURN:
		statusStr = fmt.Sprintf("%s is hurt by its burn!\n", b.currentPoke(_player))
	case STATUSFEELING_HURTPOISON:
		statusStr = fmt.Sprintf("%s is hurt by poison!\n", b.currentPoke(_player))
	case STATUSFEELING_PREVFROZEN:
		statusStr = fmt.Sprintf("%s if frozen solid!\n", b.currentPoke(_player))
	case STATUSFEELING_FREEFROZEN:
		statusStr = fmt.Sprintf("%s thawed out!\n", b.currentPoke(_player))
	}
	b.WriteToHist(statusStr)
}
开发者ID:gasperko,项目名称:pokemon-universe,代码行数:27,代码来源:battle.go

示例5: receivedHit

func (b *Battle) receivedHit(_packet *pnet.QTPacket) {
	number := _packet.ReadUint8()
	extraStr := "!"
	if number > 1 {
		extraStr = "s!"
	}
	b.WriteToHist(fmt.Sprintf("Hit %d time%s\n", number, extraStr))
}
开发者ID:gasperko,项目名称:pokemon-universe,代码行数:8,代码来源:battle.go

示例6: NewTeamFromPacket

func NewTeamFromPacket(_packet *pnet.QTPacket) *Team {
	team := Team{Pokes: make([]*TeamPoke, 6)}
	team.Gen = int(_packet.ReadUint8())
	for i := 0; i < 6; i++ {
		team.Pokes[i] = NewTeamPokeFromPacket(_packet)
	}
	return &team
}
开发者ID:gasperko,项目名称:pokemon-universe,代码行数:8,代码来源:team.go

示例7: NewRearrangeChoiceFromPacket

func NewRearrangeChoiceFromPacket(_packet *pnet.QTPacket) *RearrangeChoice {
	rearrangeChoice := RearrangeChoice{}
	rearrangeChoice.PokeIndexes = make([]int, 6)
	for i := 0; i < 6; i++ {
		rearrangeChoice.PokeIndexes[i] = int(_packet.ReadUint8())
	}

	return &rearrangeChoice
}
开发者ID:gasperko,项目名称:pokemon-universe,代码行数:9,代码来源:battlechoice.go

示例8: receivedChangePP

func (b *Battle) receivedChangePP(_packet *pnet.QTPacket) {
	moveNum := int(_packet.ReadUint8())
	newPP := int(_packet.ReadUint8())
	b.displayedMoves[moveNum].CurrentPP = newPP
	b.myTeam.Pokes[0].Moves[moveNum].CurrentPP = newPP

	// Send updateMovePP to PUClient
	SendBattleEvent_ChangePP(b.owner.player, 0, moveNum, newPP)
}
开发者ID:gasperko,项目名称:pokemon-universe,代码行数:9,代码来源:battle.go

示例9: NewBattleDynamicInfoFromPacket

func NewBattleDynamicInfoFromPacket(_packet *pnet.QTPacket) *BattleDynamicInfo {
	battleDynamicInfo := BattleDynamicInfo{}
	battleDynamicInfo.Boosts = make([]byte, 7)
	for i := 0; i < 7; i++ {
		battleDynamicInfo.Boosts[i] = _packet.ReadUint8()
	}
	battleDynamicInfo.Flags = _packet.ReadUint8()

	return &battleDynamicInfo
}
开发者ID:gasperko,项目名称:pokemon-universe,代码行数:10,代码来源:battledynamicinfo.go

示例10: NewQColorFromPacket

func NewQColorFromPacket(_packet *pnet.QTPacket) *QColor {
	color := QColor{}
	color.Spec = _packet.ReadUint8()
	color.Alpha = _packet.ReadUint16()
	color.Red = _packet.ReadUint16()
	color.Green = _packet.ReadUint16()
	color.Blue = _packet.ReadUint16()
	color.Pad = _packet.ReadUint16()
	color.Html = ">"

	return &color
}
开发者ID:gasperko,项目名称:pokemon-universe,代码行数:12,代码来源:qcolor.go

示例11: receivedBattleEnd

func (b *Battle) receivedBattleEnd(_packet *pnet.QTPacket, _player int) {
	result := int(_packet.ReadUint8())
	if result == BATTLERESULT_TIE {
		b.WriteToHist(fmt.Sprintf("Tie between %v and %v.\n", b.players[0].Nick, b.players[1].Nick))
	} else {
		b.WriteToHist(fmt.Sprintf("%v won the battle!\n", b.players[_player].Nick))
	}
	b.gotEnd = true

	// Update pokemon data of player
	b.owner.UpdatePokemonData()

	// TODO: Send endBattle to PU client
}
开发者ID:gasperko,项目名称:pokemon-universe,代码行数:14,代码来源:battle.go

示例12: receivedEffective

func (b *Battle) receivedEffective(_packet *pnet.QTPacket) {
	eff := _packet.ReadUint8()
	switch eff {
	case 0:
		b.WriteToHist("It had no effect!\n")
	case 1:
		fallthrough
	case 2:
		b.WriteToHist("It's not very effective...\n")
	case 8:
		fallthrough
	case 16:
		b.WriteToHist("It's super effective!\n")
	}
}
开发者ID:gasperko,项目名称:pokemon-universe,代码行数:15,代码来源:battle.go

示例13: receivedAbsStatusChange

func (b *Battle) receivedAbsStatusChange(_packet *pnet.QTPacket, _player int) {
	poke := int(_packet.ReadUint8())
	status := uint(_packet.ReadUint8())

	if (poke >= 0 || poke < 6) && status != STATUS_CONFUSED {
		b.pokes[_player][poke].ChangeStatus(status)
		if _player == b.me {
			b.myTeam.Pokes[poke].ChangeStatus(status)
		}

		// if b.isOut(poke) {
		// TODO: Send updatePokes to PU client
		// }
		// TODO: Send updatePokeballs to PU client
	}
}
开发者ID:gasperko,项目名称:pokemon-universe,代码行数:16,代码来源:battle.go

示例14: NewBattleChoiceFromPacket

func NewBattleChoiceFromPacket(_packet *pnet.QTPacket) *BattleChoice {
	battleChoice := BattleChoice{}
	battleChoice.PlayerSlot = int(_packet.ReadUint8())
	battleChoice.ChoiceType = int(_packet.ReadUint8())

	switch battleChoice.ChoiceType {
	case CHOICETYPE_SWITCHTYPE:
		battleChoice.Choice = NewSwitchChoiceFromPacket(_packet)
	case CHOICETYPE_ATTACKTYPE:
		battleChoice.Choice = NewAttackChoiceFromPacket(_packet)
	case CHOICETYPE_REARRANGETYPE:
		battleChoice.Choice = NewRearrangeChoiceFromPacket(_packet)
	}

	return &battleChoice
}
开发者ID:gasperko,项目名称:pokemon-universe,代码行数:16,代码来源:battlechoice.go

示例15: receiveOfferChoice

func (b *Battle) receiveOfferChoice(_packet *pnet.QTPacket) {
	_packet.ReadUint8() // We don't need it (numSlot)
	b.allowSwitch = _packet.ReadBool()
	b.allowAttack = _packet.ReadBool()
	canDoAttack := false
	for i := 0; i < 4; i++ {
		b.allowAttacks[i] = _packet.ReadBool()
		if b.allowAttacks[i] {
			canDoAttack = true
		}
	}

	if b.allowAttack && !canDoAttack {
		b.shouldStruggle = true
	} else {
		b.shouldStruggle = false
	}

	// TODO: Send updateButtons to PU client
}
开发者ID:gasperko,项目名称:pokemon-universe,代码行数:20,代码来源:battle.go


注:本文中的Network.QTPacket.ReadUint8方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。