
07-18-2011, 09:04 PM
|
Hill Giant
|
|
Join Date: Sep 2006
Posts: 172
|
|
Quote:
Originally Posted by lerxst2112
You don't need an int64 to hold a color, they are 24 bits and fit just fine in an int.
Try something like this. I didn't compile it, but you should be able to get the idea from it.
Code:
if(!strcasecmp(sep->arg[1], "armorcolor")) {
if(c->GetTarget() && c->GetTarget()->IsBot() && (c->GetTarget()->CastToBot()->GetBotOwner() == c)) {
if(sep->argnum < 6) {
c->Message(0, "Usage: #bot armorcolor [slot] [red] [green] [blue] - use #bot help armorcolor for info");
return;
}
int setslot = atoi(sep->arg[2]);
uint8 red = atoi(sep->arg[3];
uint8 green = atoi(sep->arg[4];
uint8 blue = atoi(sep->arg[5];
uint32 setcolor = (red << 16) | (green << 8) || blue;
//You may not need this, but I believe if a color is set that the top bits must be 0xff
if(setcolor) {
setcolor &= (0xff << 24);
}
}
A few of other things...
1) Change Bot::GetID to be const, don't make a new function that does exactly the same thing.
2) You don't need to use Bot::GetEquipmentColor() to call your function, just GetEquipmetColor() will call it.
3) You don't need Bot::SendWearChange at all. It's just a copy of Mob::SendWearChange.
|
Thank you for the tips.
Running tests right now.
Criimson
|