Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Conquer Online 2 > CO2 Private Server
You last visited: Today at 20:58

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Alternate Equipment (Packet 1009: 45)

Discussion on Alternate Equipment (Packet 1009: 45) within the CO2 Private Server forum part of the Conquer Online 2 category.

Reply
 
Old 01/21/2013, 05:52   #16
 
{ Angelius }'s Avatar
 
elite*gold: 0
Join Date: Aug 2010
Posts: 991
Received Thanks: 1,107
Quote:
Originally Posted by pro4never View Post
..... Maybe it's just me being picky but why would you handle it this way?

What difference does it make if you are currently using alternate or standard gear?

What about the gears attributes? see i have a single static value for each Attack/Defense/Dodge/etc whenever you change from alt to standard/the other way around everything goes back to 0 and recalculated again based on the gears you switched to aside from the on equip/un-equip calculation.
Or wold you rather keeping a separate set of attributes for both alt/standard gears ?
And if you are talking about the AltgearsOn boolean itself... people use bots even in private servers and i don't wont someone sending a random switch packet and the server just goes on and loops through the gears just because i didn't add a simple boolean !AltgearsOn return; done deal

Why would you recalculate stats every time you loop through and change a piece of gear?

First thing both cases 44/45 don't mean that the client is changing a piece of gear simply you are being notified that the client just switched to alt/standard gears and being asked for the new attributes "packet 1040" and to spawn the new equipped gears "Packet 1009 ST 46"
And by recalculating the stats. i meant the ones that wold show up on the client side on the stats window not the ones used in the actual server attack/defense calculation..In other words the attributes sent in packet 1040 has to be recalculated and sent to the client whenever you switch to alt/normal gears

Why would you loop through ALL entries and then check if they are ones you want? Just loop through a valid range...

You have a total of how many 21/22 slots both alt/normal? how long does it take to loop through let say 25 items 0 ms? yes you wouldn't even notice it and once the loop starts there is no difference unless we are talking about hundreds of items in the collection so why is it a problem i don't get it.. Besides like i mentioned earlier the attributes has to be recalculated and sent to the client "packet 1040"
and i understand this is how you wold like to go about it ?

for(byte i = 21; i <= 29; i++)
{
if (i is there/!= null/whatever)
{
//do your thing
//take of the item attributes
}
else
{
//i is not there... to bad loop goes on
}
}
You looped through 9 items already why not just continue the loop in 1 single loop and recalculate the attributes for the gears that the player just switched to all at once or wold you rather creating another loop to recalculate the attributes

for(byte i = 1; i <= 18; i++)
{
if (i is there/!= null/whatever)
{
//calculate the item attributes
}
else
{
//i is not there... to bad loop goes on
}
}
I hope i made my self clear enough...
{ Angelius } is offline  
Old 01/21/2013, 18:43   #17
 
elite*gold: 21
Join Date: Jul 2005
Posts: 9,193
Received Thanks: 5,376
You're missing my point...

#1 Recalculating stats

Calculate it after the items are all equipped... the way you're doing it performs the same calculation for each piece of gear swapped... horribly inefficient.


#2: Loop through valid range

There's no reason to loop all the slots... only loop the ones needed. Anything more and you're wasting cpu cycles with ZERO benefit.
pro4never is offline  
Thanks
2 Users
Old 01/22/2013, 03:03   #18
 
{ Angelius }'s Avatar
 
elite*gold: 0
Join Date: Aug 2010
Posts: 991
Received Thanks: 1,107
Quote:
Originally Posted by pro4never View Post
You're missing my point...

#1 Recalculating stats

Calculate it after the items are all equipped... the way you're doing it performs the same calculation for each piece of gear swapped... horribly inefficient.


#2: Loop through valid range

There's no reason to loop all the slots... only loop the ones needed. Anything more and you're wasting cpu cycles with ZERO benefit.
So a simple loop that you don't even understand what it does or how it works is horribly inefficient and a waste cpu cycles... Oh i wold love to see how you wold code it pro... care to show us how?

You know we can always learn from Pro's like your self especially after i saw the way you coded hell mouth in all its versions...

I expect your code to be totally efficient without "QUOTE"wasting cpu cycles"UNQUOTE" that includes switching from alt/standard gears and viceversa and calculating the stats at the same time
{ Angelius } is offline  
Old 01/22/2013, 11:10   #19


 
Korvacs's Avatar
 
elite*gold: 20
Join Date: Mar 2006
Posts: 6,125
Received Thanks: 2,518
lol Angelius, every time you post you embarrass yourself, Pro is right your code is horribly inefficient.
Korvacs is offline  
Old 01/22/2013, 13:20   #20
 
_DreadNought_'s Avatar
 
elite*gold: 28
Join Date: Jun 2010
Posts: 2,223
Received Thanks: 867
The ****?

As tao once said "If you're worried about a few hundred cpu cycles C# isn't for you"
_DreadNought_ is offline  
Thanks
1 User
Old 01/22/2013, 13:32   #21


 
Korvacs's Avatar
 
elite*gold: 20
Join Date: Mar 2006
Posts: 6,125
Received Thanks: 2,518
The main issue with his code for me is that he recalculates the stats for attack/defence/hp/etc for every piece of gear in the array, its completely redundant, a complete waste of time, and completely inefficient. They should be calculated once after the loop.

Further, having code execute for no reason at all should be avoided like the plague, that's the point, the number of wasted cpu cycles isnt really relevant, though they are being wasted.
Korvacs is offline  
Thanks
1 User
Old 01/22/2013, 13:51   #22
 
elite*gold: 0
Join Date: Mar 2012
Posts: 29
Received Thanks: 4
Ok thanks alll..
Adventure-MMO is offline  
Old 01/22/2013, 14:03   #23
 
_DreadNought_'s Avatar
 
elite*gold: 28
Join Date: Jun 2010
Posts: 2,223
Received Thanks: 867
Quote:
Originally Posted by Korvacs View Post
The main issue with his code for me is that he recalculates the stats for attack/defence/hp/etc for every piece of gear in the array, its completely redundant, a complete waste of time, and completely inefficient. They should be calculated once after the loop.

Further, having code execute for no reason at all should be avoided like the plague, that's the point, the number of wasted cpu cycles isnt really relevant, though they are being wasted.
For once I couldn't agree more.
_DreadNought_ is offline  
Old 01/22/2013, 22:22   #24
 
elite*gold: 21
Join Date: Jul 2005
Posts: 9,193
Received Thanks: 5,376
Quote:
Originally Posted by _DreadNought_ View Post
The ****?

As tao once said "If you're worried about a few hundred cpu cycles C# isn't for you"
Korv already answered this but I want my 2c in here as well.

Yes, a few cpu cycles make virtually no difference but he is over complicating things. It's poor program design and something we should all be trying to avoid (regardless of what we're coding).

I'm calling him out on some bad programming habits rather than leaving them as an uncontested example for others to learn from (which simply encourages poor coding all around).


@Angelus. Hellmouth and Albetros were complete learning projects. You're more than welcome to judge me for them as it was my first real program I tried to code. I've done PLENTY since then and a number of courses related to program design. If you so much as hinted at coding something in the way you're describing in the workplace or on assignments you'd be running into more issues than just 'wasted cpu cycles'.


Again... not trying to be harsh here, I'm just pointing out some things that can be easily fixed to improve the code.
pro4never is offline  
Old 01/23/2013, 08:26   #25
 
{ Angelius }'s Avatar
 
elite*gold: 0
Join Date: Aug 2010
Posts: 991
Received Thanks: 1,107
Quote:
Originally Posted by Korvacs View Post
lol Angelius, every time you post you embarrass yourself, Pro is right your code is horribly inefficient.
embarrass my self? why because i am trying to make you fools Pro/your self understand that you are both wrong? is that embarrassing? Are you retarded or something bro? I am not wrong and i am gonna prove it in a sec, And i asked for CODE not for stupid opinions like yours so code it the right way and post it here so we can all see it or stfu and stop running your mouth like you know what you are talking about....

And as long as a simple 5 lines loop that i posted is horribly inefficient why don't you come up with whats better and post it here... or you don't have the balls to do so and you only run your mouth here and there?

Quote:
Originally Posted by Korvacs View Post
The main issue with his code for me is that he recalculates the stats for attack/defence/hp/etc for every piece of gear in the array, its completely redundant, a complete waste of time, and completely inefficient. They should be calculated once after the loop.

Further, having code execute for no reason at all should be avoided like the plague, that's the point, the number of wasted cpu cycles isnt really relevant, though they are being wasted.
Here we go again like you know what you are talking about....

Here is the thing...

Quote:
Originally Posted by pro4never View Post
Is ALTHeadgear null? If not swap ALTHeadgear with Headgear
Do this for all the slots and then update both the client and local users to the changes.
Tada! Fully working and as efficient as you're going to get it.
Meaning...
for(byte i = number; i <= number; i++)
{
if (ClientItems[i] != null)
{
//do your thing
}
else
{
//Wasted cpu cycle unless you are gonna summon a new item out of the blue and give it to the player as a gift
}
}

So between the alt/standard gears if i am waring 1 single alt item and 1 single standard item that's 20+ wasted cpu cycles every time i switch from alt to standard/the other way around...

At the time in my code it goes this way

foreach (ItemInfo I in ThreadSafe(Client.Equipment).Values)
{
if (I.AltGear())
{
//Remove the item status
}
else
{
//Add the item status
}
}
So basically if i am waring 2 items the Client.Equipment count will be 2 and its going to loop 2 times no more... 1 it loops 1 time none it doesn't loop at all AND it calculates the stats at the same time... so which one of us is wasting cpu cycles?

Back to Korvacs stupid opinion..

Quote:
Originally Posted by Korvacs View Post
The main issue with his code for me is that he recalculates the stats for attack/defence/hp/etc for every piece of gear in the array, its completely redundant, a complete waste of time, and completely inefficient. They should be calculated once after the loop
Now you say... They should be calculated once after the loop
So after we loop through the correct range like pro suggested which turns to be horribly inefficient. and a total waste of cpu cycles WE LOOP AGAIN TO CALCULATE THE STATS? How stupid are you huh? and you wanna talk about cpu cycles and crap, do you even know what you are talking about?

Unless you have a magical way to calculate all items stats after the loop with out LOOPING through those items again...which i doubt

So to both of you CPU Protectors you guys suck...

Quote:
Originally Posted by pro4never View Post
Korv already answered this but I want my 2c in here as well.

Yes, a few cpu cycles make virtually no difference but he is over complicating things. It's poor program design and something we should all be trying to avoid (regardless of what we're coding).

I'm calling him out on some bad programming habits rather than leaving them as an uncontested example for others to learn from (which simply encourages poor coding all around).


@Angelus. Hellmouth and Albetros were complete learning projects. You're more than welcome to judge me for them as it was my first real program I tried to code. I've done PLENTY since then and a number of courses related to program design. If you so much as hinted at coding something in the way you're describing in the workplace or on assignments you'd be running into more issues than just 'wasted cpu cycles'.


Again... not trying to be harsh here, I'm just pointing out some things that can be easily fixed to improve the code.
Guess what that code block that i posted is taken from angelic-co MY learning project and still i didn't make excuses like you did.

You are not capable of doing what you are saying and if you do i promise you i will prove that my completely redundant, complete waste of time, and completely inefficient code is better then whatever you are gonna come up with.. just for fun

A person with 1 month programing experience and a limited math knowledge can understand and see the deference. YOU don't so why don't find someone else to pick on...
{ Angelius } is offline  
Old 01/23/2013, 09:13   #26


 
Korvacs's Avatar
 
elite*gold: 20
Join Date: Mar 2006
Posts: 6,125
Received Thanks: 2,518
Quote:
Originally Posted by { Angelius } View Post
Now you say... They should be calculated once after the loop
So after we loop through the correct range like pro suggested which turns to be horribly inefficient. and a total waste of cpu cycles WE LOOP AGAIN TO CALCULATE THE STATS? How stupid are you huh? and you wanna talk about cpu cycles and ****, do you even know what you are talking about?

Unless you have a magical way to calculate all items stats after the loop with out LOOPING through those items again...which i doubt
So by this statement, your suggesting its impossible to calculate the new stats for a character without looping through all the gear.

Which, if this is true, means that your code loops through the gear to perform the switch, then loops through all of the gear to recalculate the stats....every time.

Like I said, you embarrass yourself every time you post.
Korvacs is offline  
Old 01/23/2013, 09:33   #27
 
{ Angelius }'s Avatar
 
elite*gold: 0
Join Date: Aug 2010
Posts: 991
Received Thanks: 1,107
Quote:
Originally Posted by Korvacs View Post
So by this statement, your suggesting its impossible to calculate the new stats for a character without looping through all the gear.

Which, if this is true, means that your code loops through the gear to perform the switch, then loops through all of the gear to recalculate the stats....every time.

Like I said, you embarrass yourself every time you post.
You are a total id*ot bro...

Switching from standard to alt...
PHP Code:
foreach (ItemInfo I in ThreadSafe(Client.Equipment).Values)
//Client.Equipment contains both alt and standard gears at all times if you wish to waste a few cpu cycles
//If not and you are cpu friendly like pro/yourself Client.Equipment contains only alt gears or standard gears 
                            
{
                                if (
I.AltGear())//in case it contains both alt/standard gears other then that you don't need the IF and the ELSE statements
                                
{
                                    
Packet Packet1040();
                                    
Packet1040.attack += item attack
                                    Packet1040
.defense += item def
                                    Packet1040
.dodge +=  item dodge
                                    
//etc 
                                
}
                                else
                                {
                                    
//do whatever you want 
                                
}
                            }
                            
Client.Send(Packet1040); 
Where in hell do you see more then 1 loop...
Where in hell do you see any switches...

Why the F wold you loop again to calculate the stats like you stupidly suggested when you said....

Quote:
Originally Posted by Korvacs View Post
The main issue with his code for me is that he recalculates the stats for attack/defence/hp/etc for every piece of gear in the array, its completely redundant, a complete waste of time, and completely inefficient. They should be calculated once after the loop.
How can it be any easier than that....

What now you are gonna talk about wasted cpu cycles again? Mor*n
{ Angelius } is offline  
Old 01/23/2013, 10:05   #28


 
Korvacs's Avatar
 
elite*gold: 20
Join Date: Mar 2006
Posts: 6,125
Received Thanks: 2,518
LOL, this just gets more and more hilarious to me, you keep contradicting yourself, first (according to you) you cant calculate stats without a loop, now you can. Now were talking about CPU cycles, even though I said it was irrelevant.
Korvacs is offline  
Old 01/23/2013, 11:13   #29
 
elite*gold: 0
Join Date: Sep 2012
Posts: 775
Received Thanks: 327
fights goes over and over and we gets bits of codes and informations keep going guys you doing awesome job
go for it is offline  
Old 01/23/2013, 13:02   #30
 
{ Angelius }'s Avatar
 
elite*gold: 0
Join Date: Aug 2010
Posts: 991
Received Thanks: 1,107
Quote:
Originally Posted by Korvacs View Post
LOL, this just gets more and more hilarious to me, you keep contradicting yourself, first (according to you) you cant calculate stats without a loop, now you can. Now were talking about CPU cycles, even though I said it was irrelevant.
How am i calculating the stats without a loop...

What do you call this > foreach (ItemInfo I in ThreadSafe(Client.Equipment).Values) A dead cow?

hilarious? You are not funny so stop trying... Mor*n
{ Angelius } is offline  
Reply


Similar Threads Similar Threads
Alternate equipment.
04/11/2012 - CO2 Private Server - 6 Replies
Has anyone added it? For some reason when I try to switch to the alternate equipment the client doesn't send anything to the server so I think maybe I should send another packet first ... has anyone got an idea which that would be?
Packet type 1009(item) subtype 52
04/05/2011 - CO2 Programming - 2 Replies
Does anyone know how to handle this packet? It's what makes this happen : http://img685.imageshack.us/img685/9016/prtscrcap turex.jpg Sending data back doesn't work. Help?
Alternate Equipment glitch
03/13/2010 - CO2 Exploits, Hacks & Tools - 19 Replies
This glitch allows you to have the effects of a poison blade, mana backsword or health backsword without actually having them equipped. All you have to do is equip either a poison blade, mana backsword or health backsword (Whichever effect you want) into your alternate equipment weapon slot. *Note* if you press the button which swaps it from one type of equipment to the other and then back, you'll have to re-do this. Archer verses archer helps a lot if you have a health backsword...
Alternate equipment glitch
01/27/2010 - CO2 Guides & Templates - 6 Replies
Yo, since i want it to get patched ill post it :P, Requirments: 1.Rb above lvl 70 and claimed level 70 promotion(This is for strong tros level 130 with 2 sdg gears) 2.Any lvl bow for 1 - 70 (Bow level 70 would be the best) 3.Put the bow in your alternate equipment,Buy a fire arrow(U can buy it from ape city) 4.Put the arrow in the alternate equipment. 5.Drag the alternative equipment button and put it on any F keys which u like. How to use:



All times are GMT +2. The time now is 20:58.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.