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


Golang QTPacket.ReadBool方法代码示例

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


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

示例1: 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

示例2: 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

示例3: receivedRated

func (b *Battle) receivedRated(_packet *pnet.QTPacket) {
	rated := "Unrated"
	if _packet.ReadBool() {
		rated = "Rated"
	}
	b.WriteToHist("Rule: " + rated + "\n")

	// TODO: Print clauses
}
开发者ID:gasperko,项目名称:pokemon-universe,代码行数:9,代码来源:battle.go

示例4: receivedSubstitute

func (b *Battle) receivedSubstitute(_packet *pnet.QTPacket, _player int) {
	isSub := _packet.ReadBool()
	b.currentPoke(_player).Sub = isSub
	if _player == b.me {
		// TODO: Send updateMyPoke to PU client
	} else {
		// TODO: Send updateOppPoke to PU client
	}
}
开发者ID:gasperko,项目名称:pokemon-universe,代码行数:9,代码来源:battle.go

示例5: NewFullPlayerInfoFromPacket

func NewFullPlayerInfoFromPacket(_packet *pnet.QTPacket) *FullPlayerInfo {
	fullPlayerInfo := &FullPlayerInfo{}
	fullPlayerInfo.Team = NewPlayerTeamFromPacket(_packet)
	fullPlayerInfo.IsDefault = true
	fullPlayerInfo.ladderEnabled = _packet.ReadBool()
	fullPlayerInfo.showTeam = _packet.ReadBool()
	fullPlayerInfo.nameColor = NewQColorFromPacket(_packet)

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

示例6: NewShallowBattlePokeFromPacket

func NewShallowBattlePokeFromPacket(_packet *pnet.QTPacket, _isMe bool) *ShallowBattlePoke {
	shallowPoke := ShallowBattlePoke{Types: make([]int, 2)}
	shallowPoke.UID = NewUniqueIdFromPacket(_packet)
	shallowPoke.RNick = _packet.ReadString()
	shallowPoke.Nick = shallowPoke.RNick
	if !_isMe {
		shallowPoke.Nick = "the foe's " + shallowPoke.Nick

		shallowPoke.getName()
		shallowPoke.getTypes()
	}

	shallowPoke.LifePercent = int(_packet.ReadUint8())
	shallowPoke.fullStatus = _packet.ReadUint32()
	shallowPoke.Gender = int(_packet.ReadUint8())
	shallowPoke.Shiny = _packet.ReadBool()
	shallowPoke.Level = int(_packet.ReadUint32())

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

示例7: 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

示例8: receivedStatusChange

func (b *Battle) receivedStatusChange(_packet *pnet.QTPacket, player int) {
	status := int(_packet.ReadUint8())
	multipleTurns := _packet.ReadBool()
	if status > STATUS_FINE && status <= STATUS_POISONED {
		statusChangeMessages := make([]string, 6)
		statusChangeMessages[0] = "is paralyzed! It may be unable to move!"
		statusChangeMessages[1] = "fell asleep!"
		statusChangeMessages[2] = "was frozen solid!"
		statusChangeMessages[3] = "was burned!"
		statusChangeMessages[4] = "was poisoned!"
		statusChangeMessages[5] = "was badly poisoned!"

		statusIndex := status - 1
		if status == STATUS_POISONED && multipleTurns {
			statusIndex += 1
		}

		b.WriteToHist(fmt.Sprintf("%s %s\n", b.currentPoke(player).Nick, statusChangeMessages[statusIndex]))
	} else if status == STATUS_CONFUSED {
		b.WriteToHist(fmt.Sprintf("%s became confused!\n", b.currentPoke(player).Nick))
	}
}
开发者ID:gasperko,项目名称:pokemon-universe,代码行数:22,代码来源:battle.go

示例9: receivedSendOut

// -------------------- Received Messages ----------------------
func (b *Battle) receivedSendOut(_packet *pnet.QTPacket, _player int) {
	isSilent := _packet.ReadBool()
	fromSpot := int(_packet.ReadUint8())

	if _player == b.me {
		// tmp := b.myTeam.Pokes[0]
		b.myTeam.Pokes[0], b.myTeam.Pokes[fromSpot] = b.myTeam.Pokes[fromSpot], b.myTeam.Pokes[0]
		for i := 0; i < 4; i++ {
			b.displayedMoves[i] = NewBattleMoveFromBattleMove(b.myTeam.Pokes[0].Moves[i])
		}
	}

	b.pokes[_player][0], b.pokes[_player][fromSpot] = b.pokes[_player][fromSpot], b.pokes[_player][0]
	if _packet.GetMsgSize() > _packet.GetReadPos() { // this is the first time you've seen it
		b.pokes[_player][0] = NewShallowBattlePokeFromPacket(_packet, (_player == b.me))
	}

	// TOOD: Send updatePokes to PU client
	// TODO: Send updatePokeballs to PU client

	if !isSilent {
		b.WriteToHist(fmt.Sprintf("%s sent out %s!\n", b.players[_player].Nick, b.currentPoke(_player).RNick))
	}
}
开发者ID:gasperko,项目名称:pokemon-universe,代码行数:25,代码来源:battle.go

示例10: ReceiveCommand

func (b *Battle) ReceiveCommand(_packet *pnet.QTPacket) {
	bc := int(_packet.ReadUint8())
	player := int(_packet.ReadUint8())
	fmt.Printf("Battle command received: %d | PlayerId: %d\n", bc, player)
	switch bc {
	case BattleCommand_SendOut: // 0
		b.receivedSendOut(_packet, player)
	case BattleCommand_SendBack: // 1
		b.receivedSendBack(player)
	case BattleCommand_UseAttack: // 2
		b.receivedUseAttack(_packet, player)
	case BattleCommand_OfferChoice: // 3
		b.receiveOfferChoice(_packet)
	case BattleCommand_BeginTurn: // 4
		b.receivedBeginTurn(_packet)
	case BattleCommand_ChangePP: // 5
		b.receivedChangePP(_packet)
	case BattleCommand_ChangeHp: // 6
		b.receivedChangeHp(_packet, player)
	case BattleCommand_Ko: // 7
		b.receivedKo(player)
	case BattleCommand_Effective: // 8
		b.receivedEffective(_packet)
	case BattleCommand_Miss: // 9
		b.receivedMiss(player)
	case BattleCommand_CriticalHit: // 10
		b.receivedCriticalHit()
	case BattleCommand_Hit: // 11
		b.receivedHit(_packet)
	case BattleCommand_StatChange: // 12
		b.receivedStatChange(_packet, player)
	case BattleCommand_StatusChange: // 13
		b.receivedStatusChange(_packet, player)
	case BattleCommand_StatusMessage: // 14
		b.receivedStatusMessage(_packet, player)
	case BattleCommand_Failed: // 15
		b.receivedFailed()
	case BattleCommand_MoveMessage: // 17
		b.receivedMoveMessage(_packet, player)
	case BattleCommand_ItemMessage: // 18
		// TODO: We don't have items yet, so do nothing for now
	case BattleCommand_NoOpponent: // 19
		b.WriteToHist("But there was no target...\n")
	case BattleCommand_Flinch: // 20
		b.WriteToHist(b.currentPoke(player).Nick + " flinched!\n")
	case BattleCommand_Recoil: // 21
		damaging := _packet.ReadBool()
		if damaging {
			b.WriteToHist(b.currentPoke(player).Nick + " is hit with recoil!\n")
		} else {
			b.WriteToHist(b.currentPoke(player).Nick + " had its energy drained!\n")
		}
	case BattleCommand_WeatherMessage: // 22
		b.receivedWeatherMesage(_packet, player)
	case BattleCommand_StraightDamage: // 23
		b.receivedStraigthDamage(_packet, player)
	case BattleCommand_AbilityMessage: // 24
		b.receivedAbilityMessage(_packet, player)
	case BattleCommand_AbsStatusChange: // 25
		b.receivedAbsStatusChange(_packet, player)
	case BattleCommand_Substitute: // 26
		b.receivedSubstitute(_packet, player)
	case BattleCommand_BattleEnd: // 27
		b.receivedBattleEnd(_packet, player)
	case BattleCommand_BlankMessage: // 28
		b.WriteToHist("\n")
	case BattleCommand_CancelMove: // 29
		b.receivedCancelMove()
	case BattleCommand_Clause: // 30
		// TODO: Do someting with this, it only writes to history so isn't that important
	case BattleCommand_DynamicInfo: // 31
		b.receiveDynamicInfo(_packet, player)
	case BattleCommand_DynamicStats: // 32
		b.receiveDynamicStats(_packet, player)
	case BattleCommand_Spectating: // 33
		// TODO: implement
	case BattleCommand_SpectatorChat: // 34
		// TODO: Implement? Or are we using our own chat (probably yes)
	case BattleCommand_AlreadyStatusMessage: // 35
		status := int(_packet.ReadUint8())
		b.WriteToHist(fmt.Sprintf("%v is already %v\n", b.currentPoke(player), puh.GetStatusById(status)))
	case BattleCommand_TempPokeChange: // 36
		b.receivedTempPokeChange(_packet, player)
	case BattleCommand_ClockStart: // 37
		b.clockStart(_packet, player)
	case BattleCommand_ClockStop: // 38
		b.clockStop(_packet, player)
	case BattleCommand_Rated: // 39
		b.receivedRated(_packet)
	case BattleCommand_TierSection: // 40
		tier := _packet.ReadString()
		b.WriteToHist("Tier: " + tier + "\n")
	case BattleCommand_EndMessage: // 41
		endMessage := _packet.ReadString()
		if len(endMessage) > 0 {
			b.WriteToHist(fmt.Sprintf("%v: %v\n", b.players[player].Nick, endMessage))
		}
	case BattleCommand_PointEstimate: // 42
		// NOT IMPLEMENTED
	case BattleCommand_MakeYourChoice: // 43
//.........这里部分代码省略.........
开发者ID:gasperko,项目名称:pokemon-universe,代码行数:101,代码来源:battle.go


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