Пример #1
0
func (self CombatStopEvent) ToString(receiver *database.Character) string {
	if receiver == self.Attacker {
		return utils.Colorize(utils.ColorGreen, fmt.Sprintf("You stopped attacking %s", self.Defender.GetName()))
	} else if receiver == self.Defender {
		return utils.Colorize(utils.ColorGreen, fmt.Sprintf("%s has stopped attacking you", self.Attacker.GetName()))
	}

	return ""
}
Пример #2
0
func (self CombatEvent) ToString(receiver *database.Character) string {
	if receiver == self.Attacker {
		return utils.Colorize(utils.ColorRed, fmt.Sprintf("You hit %s for %v damage", self.Defender.GetName(), self.Damage))
	} else if receiver == self.Defender {
		return utils.Colorize(utils.ColorRed, fmt.Sprintf("%s hits you for %v damage", self.Attacker.GetName(), self.Damage))
	}

	return ""
}
Пример #3
0
func (self CombatStartEvent) ToString(receiver *database.Character) string {
	if receiver == self.Attacker {
		return utils.Colorize(utils.ColorRed, fmt.Sprintf("You are attacking %s!", self.Defender.GetName()))
	} else if receiver == self.Defender {
		return utils.Colorize(utils.ColorRed, fmt.Sprintf("%s is attacking you!", self.Attacker.GetName()))
	}

	return ""
}
Пример #4
0
func (self SayEvent) ToString(receiver *database.Character) string {
	who := ""
	if receiver.GetId() == self.Character.GetId() {
		who = "You say"
	} else {
		who = self.Character.GetName() + " says"
	}

	return utils.Colorize(utils.ColorBlue, who+", ") +
		utils.Colorize(utils.ColorWhite, "\""+self.Message+"\"")
}
Пример #5
0
func (self *mapTile) toString() string {
	if self.char == ' ' {
		return string(self.char)
	}

	return utils.Colorize(self.color, string(self.char))
}
Пример #6
0
func (self *mapBuilder) toString() string {
	str := ""

	for z := 0; z < self.depth; z++ {
		var rows []string
		for y := 0; y < self.height; y++ {
			row := ""
			for x := 0; x < self.width; x++ {
				tile := self.data[z][y][x].toString()
				row = row + tile
			}
			rows = append(rows, row)
		}

		rows = utils.TrimLowerRows(rows)

		if self.depth > 1 {
			divider := utils.Colorize(utils.ColorWhite, "================================================================================\r\n")
			rows = append(rows, divider)
		}

		for _, row := range rows {
			str = str + row + "\r\n"
		}
	}

	return str
}
Пример #7
0
func (self LoginEvent) ToString(receiver *database.Character) string {
	return utils.Colorize(utils.ColorBlue, self.Character.GetName()) +
		utils.Colorize(utils.ColorWhite, " has connected")
}
Пример #8
0
func (self RoomUpdateEvent) ToString(receiver *database.Character) string {
	return utils.Colorize(utils.ColorWhite, "This room has been modified")
}
Пример #9
0
func (self TellEvent) ToString(receiver *database.Character) string {
	return utils.Colorize(utils.ColorMagenta, fmt.Sprintf("Message from %s: ", self.From.GetName())) +
		utils.Colorize(utils.ColorWhite, self.Message)
}
Пример #10
0
func (self EmoteEvent) ToString(receiver *database.Character) string {
	return utils.Colorize(utils.ColorYellow, self.Character.GetName()+" "+self.Emote)
}
Пример #11
0
func (self BroadcastEvent) ToString(receiver *database.Character) string {
	return utils.Colorize(utils.ColorCyan, "Broadcast from "+self.Character.GetName()+": ") +
		utils.Colorize(utils.ColorWhite, self.Message)
}