|
You last visited: Today at 19:47
Advertisement
Is this the best way?
Discussion on Is this the best way? within the CO2 Private Server forum part of the Conquer Online 2 category.
07/06/2011, 00:32
|
#1
|
elite*gold: 0
Join Date: Apr 2008
Posts: 1,152
Received Thanks: 321
|
Is this the best way?
Code:
public void ShareBP(Clan clan, Client c)
{
Team team = c.Hero.Team;
if (team != null)
{
Dictionary<Hero, UInt32> bpdict = new Dictionary<Hero, UInt32>();
foreach (TeamMember mem in team.Get)
bpdict.ThreadSafeAdd(mem.Member, mem.Member.BattlePower);
List<Hero> list = bpdict.Keys.ToList();
list.Sort();
Hero h = list.First();
}
}
is this the best way to do this? Get the player in that dict with the most battle power?
|
|
|
07/06/2011, 00:57
|
#2
|
elite*gold: 0
Join Date: Feb 2011
Posts: 335
Received Thanks: 170
|
Curious...
Whats this for?
Hero h = list.First();
You're not using the variable h at all.
|
|
|
07/06/2011, 01:06
|
#3
|
elite*gold: 12
Join Date: Jul 2011
Posts: 8,283
Received Thanks: 4,191
|
Why are you defining a new dictionary and everything? Isn't there are dictionary in your clan data? How would you be doing clan chat and stuff related to the clan without that? Same goes for what you're doing here with Teams. Doesn't your team have a dictionary in it already?
Also, with the sorting bit.. I would just have it do that automatically when adding a team member and have the id and bp save to a keypair.
|
|
|
07/06/2011, 02:09
|
#4
|
elite*gold: 0
Join Date: Apr 2008
Posts: 1,152
Received Thanks: 321
|
Quote:
Originally Posted by Fаng
Why are you defining a new dictionary and everything? Isn't there are dictionary in your clan data? How would you be doing clan chat and stuff related to the clan without that? Same goes for what you're doing here with Teams. Doesn't your team have a dictionary in it already?
Also, with the sorting bit.. I would just have it do that automatically when adding a team member and have the id and bp save to a keypair.
|
nono, so the point of this is, Clan Shared BP. My Dicationarys for Team / Clans are usually Id, MemberClass , the point for this new dict is to add them from my team by Hero and Battle power, and then the sorting is to sort them, by battle power to get the one with the highest battle power,
@arco i know im not using h variable, iam asking is this the best way to do this, ^^
|
|
|
07/06/2011, 02:20
|
#5
|
elite*gold: 12
Join Date: Jul 2011
Posts: 8,283
Received Thanks: 4,191
|
Quote:
Originally Posted by -Shunsui-
nono, so the point of this is, Clan Shared BP. My Dicationarys for Team / Clans are usually Id, MemberClass , the point for this new dict is to add them from my team by Hero and Battle power, and then the sorting is to sort them, by battle power to get the one with the highest battle power,
@arco i know im not using h variable, iam asking is this the best way to do this, ^^
|
I would just use the dictionary that you should have in your Team class... and add a void called "Add" that doesn't use that dictionary to replace the highest bp, but checks if the bp recorded (as I stated) is higher or not. If the team is removing a member, it should use the dictionary to find the next highest bp. Don't use the dictionary for finding the highest bp every time someone is added. You're going to be using the value anyways in client bp equations, so why not record it?
|
|
|
07/06/2011, 11:27
|
#6
|
elite*gold: 0
Join Date: Aug 2010
Posts: 992
Received Thanks: 1,110
|
int bp = 0; Hero WE = null;
foreach (TeamMember mem in team.Get)
if (mem.Member.BattlePower > bp) { bp = mem.Member.BattlePower; WE = mem.Member;}
WE should be the highest bp player .
|
|
|
07/06/2011, 11:30
|
#7
|
elite*gold: 12
Join Date: Jul 2011
Posts: 8,283
Received Thanks: 4,191
|
I wish people would stop using "Hero" for their char data. It's not a hero.. it's character. Just because TQ's English is terrible doesn't mean you all have to follow it.
|
|
|
07/06/2011, 11:36
|
#8
|
elite*gold: 20
Join Date: Jun 2006
Posts: 3,296
Received Thanks: 925
|
Quote:
Originally Posted by Fаng
I wish people would stop using "Hero" for their char data. It's not a hero.. it's character. Just because TQ's English is terrible doesn't mean you all have to follow it.
|
Or people just like using Hero, really you don't have the right to decide what people call things in their source.
|
|
|
07/06/2011, 11:41
|
#9
|
elite*gold: 0
Join Date: Aug 2010
Posts: 992
Received Thanks: 1,110
|
Quote:
Originally Posted by Fаng
I wish people would stop using "Hero" for their char data. It's not a hero.. it's character. Just because TQ's English is terrible doesn't mean you all have to follow it.
|
|
|
|
07/06/2011, 11:49
|
#10
|
elite*gold: 12
Join Date: Jul 2011
Posts: 8,283
Received Thanks: 4,191
|
Quote:
Originally Posted by Kiyono
Or people just like using Hero, really you don't have the right to decide what people call things in their source.
|
I'm not hammering on anyone that says they use it or that does use it- it's just not an appropriate word for this game at all. You can't have 300+ heroes ... fighting each other. It's a game of alliances, enemies, friendships, clans, guilds- NOT a video game where some hero goes off to fight for the name of a city or some weird whatever. It's a character, and i just wish people would stop calling it a hero.
|
|
|
07/06/2011, 11:51
|
#11
|
elite*gold: 20
Join Date: Mar 2006
Posts: 6,126
Received Thanks: 2,518
|
Actually its Hero because we used it in CoEmu back in the day if i recall correctly, and because Hero is a term used to describe the character that the player is playing and has been the term for 20+ years...
By definition our Characters are Heroes..
Personally i think this sort of thing should be within the Team class, the dictionary should already be there for you to use rather than creating a new one.
|
|
|
07/06/2011, 11:59
|
#12
|
elite*gold: 12
Join Date: Jul 2011
Posts: 8,283
Received Thanks: 4,191
|
Quote:
Originally Posted by Korvacs
Actually its Hero because we used it in CoEmu back in the day if i recall correctly, and because Hero is a term used to describe the character that the player is playing and has been the term for 20+ years...
By definition our Characters are Heroes..
Personally i think this sort of thing should be within the Team class, the dictionary should already be there for you to use rather than creating a new one.
|
So because CoEmu used it... it's... correct?
You're not going to question that? Why should it be called a hero really... if you think about it. I'm not picking at you, but you didn't support yourself at all.
|
|
|
07/06/2011, 12:05
|
#13
|
elite*gold: 20
Join Date: Mar 2006
Posts: 6,126
Received Thanks: 2,518
|
Quote:
Originally Posted by Fаng
So because CoEmu used it... it's... correct?
You're not going to question that? Why should it be called a hero really... if you think about it. I'm not picking at you, but you didn't support yourself at all.
|
Im not going to question if its correct or not, what people name the character class in their source is their own business, and has no relevance to anything really, so long as it describes the object to a degree that makes sense to the writer then its a perfectly valid name.
In my current project the Character/Hero object is simply known as Entity, although i intend to use it to describe more than just the Character, but again it makes sense to me.
So to go back to what would be correct...
The correct term to describe the object is whatever makes sense to you, naming conventions in this case would go as far as to say that it should accurately describe the object, but that would be about it.
|
|
|
07/06/2011, 13:33
|
#14
|
elite*gold: 21
Join Date: Jul 2005
Posts: 9,193
Received Thanks: 5,380
|
Player class be repin'?
*woot woot*
|
|
|
07/06/2011, 13:44
|
#15
|
elite*gold: 0
Join Date: May 2005
Posts: 1,892
Received Thanks: 920
|
In my proxy, I use class Hero to describe MY character, and class Player to describe other players. Just saying.
Edit: After I posted this, I realized I should make an abstract class named Entity and inherit it for all entity-based classes.
|
|
|
All times are GMT +1. The time now is 19:49.
|
|