Is this the best way?

07/06/2011 00:32 -Shunsui-#1
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 Arco.#2
Curious...
Whats this for?
Hero h = list.First();

You're not using the variable h at all.
07/06/2011 01:06 Spirited#3
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 -Shunsui-#4
Quote:
Originally Posted by Fаng View Post
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 Spirited#5
Quote:
Originally Posted by -Shunsui- View Post
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 { Angelius }#6
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 Spirited#7
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 Kiyono#8
Quote:
Originally Posted by Fаng View Post
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 { Angelius }#9
Quote:
Originally Posted by Fаng View Post
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.
:bandit:
07/06/2011 11:49 Spirited#10
Quote:
Originally Posted by Kiyono View Post
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 Korvacs#11
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 Spirited#12
Quote:
Originally Posted by Korvacs View Post
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 Korvacs#13
Quote:
Originally Posted by Fаng View Post
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 pro4never#14
Player class be repin'?

*woot woot*
07/06/2011 13:44 Lateralus#15
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.