PDA

View Full Version : Submission: #bot list


Taurinus
08-10-2009, 10:45 PM
This is a change that I have committed on my end and I thought I would share it.

It uses the existing client UI interface to send the bot list to the client via Popup. It helps lower the business of the chat window. It also rectifies filtering logic (i.e. #bot list 1) for classes.

bot.cpp

2009-08-10 20:32:18.694884800 -0500
@@ -8467,7 +8467,7 @@

if(!strcasecmp(sep->arg[1], "list")) {
bool listAll = true;
- int iClass = atoi(sep->arg[2]);
+ uint16 iClass = (uint16) atoi(sep->arg[2]);

if(iClass > 0 && iClass < 17)
listAll = false;
@@ -8480,14 +8480,21 @@
}

if(!AvailableBots.empty()) {
+ std::stringstream botListStringStream;
+ std::string botListString;
for(std::list<BotsAvailableList>::iterator TempAvailable
BotsList = AvailableBots.begin(); TempAvailableBotsList != AvailableBots.end();
TempAvailableBotsList++) {
- if(listAll) {
- c->Message(0, "ID: %u -- Class: %s -- Na
me: %s -- Race: %s", TempAvailableBotsList->BotID, ClassIdToString(TempAvailable
BotsList->BotClass).c_str(), TempAvailableBotsList->BotName, RaceIdToString(Temp
AvailableBotsList->BotRace).c_str());
+ if(listAll) {

+
+ botListStringStream <<"ID: " << TempAvai
lableBotsList->BotID << " " << TempAvailableBotsList->BotName << " " << RaceIdTo
String(TempAvailableBotsList->BotRace) << " " << ClassIdToString(TempAvailableBo
tsList->BotClass) << "<br>";
+
}
else {
- if(TempAvailableBotsList->BotClass == iC
lass)
- c->Message(0, "ID: %u -- Class:
%s -- Name: %s -- Race: %s", TempAvailableBotsList->BotID, ClassIdToString(TempA
vailableBotsList->BotClass).c_str(), TempAvailableBotsList->BotName, RaceIdToStr
ing(TempAvailableBotsList->BotRace).c_str());
+ if(TempAvailableBotsList->BotClass == iC
lass)
+ botListStringStream <<"ID: " <<
TempAvailableBotsList->BotID << " " << TempAvailableBotsList->BotName << " " <<
RaceIdToString(TempAvailableBotsList->BotRace) << " " << ClassIdToString(TempAva
ilableBotsList->BotClass) << "<br>";
+
}
+ botListString = botListStringStream.str();
+ c->SendPopupToClient("Available Bots", botListSt
ring.c_str());
}
}
else {


I plan to also make this change to "#bot inventory list". I will post that when I have it done if anyone is interested.

WildcardX
08-10-2009, 11:07 PM
Yeah go ahead and post it when your done and I'll take a look. I was planning on doing something different than what you have here, but its going to be a while before I have the time to get to it as i consider it a lower priority task. So until I do get around to my idea, I'd be happy to implement your idea as its still better than what we have now.

WildcardX
08-10-2009, 11:16 PM
My apologies, I looked this code over closer and i realized it uses the same idea I had, except I planned to make the "bot version of the character inventory button" so the screen would include items, hitpoints, mana, bot level, bot name, class, etc. You should run with your idea and when your done post it to me and I'll look it over to integrate it into the bot code. good luck!

Taurinus
08-10-2009, 11:31 PM
Thanks for the consideration, WildcardX.

The bot code has come a long way since you've started transforming it. I know that there is alot of work left to be done, and I don't mind chipping in what I can.

I will be the first with a "dude, this bot code is broken!" but I'm also in Visual Studio looking through it. I wish I understood the code on a broader scope but I am reading through it on a regular basis and getting to know it.

Taurinus
08-11-2009, 07:36 AM
Here are some screenies of what I've thrown together already.

http://yfrog.com/2ieq000036jx

steve
08-11-2009, 09:07 AM
Interesting. I've never messed with bots before but I read on the EQLive forums that NPCs only have one bracer, earring, and ring slot. Apparently we're doing better in that area than them :)

WildcardX
08-11-2009, 02:05 PM
i still think Sony stole their mercs from our bots. I believe we had bots before they had mercs.

Taurinus
08-11-2009, 05:09 PM
r920 seems to have removed the need for a popup for inventory purposes. Great job on that.

I still feel that a popup for the bot list is cleaner, though. You may have another idea for this, I know.

WildcardX
08-11-2009, 05:23 PM
i think both have their purposes.. Again, for your popup window I am thinking something more along the lines of all the info you get as a character by pressing your "I" key, but for bots.

Taurinus
08-11-2009, 08:08 PM
I am still working with the inventory popup and I can display the stats just fine. The problem I am having is prettying it up, because it seems the popup window does accept most html tags but does not display them properly (i.e. tables). The html support is pretty rudimentary, so I am going to be limited as to just how good it can look.

I will post a diff later this evening.

WildcardX
08-11-2009, 08:24 PM
Just do the best you can.

Taurinus
08-11-2009, 10:40 PM
Here is my work so far:

New bot command "stats" is implemented. You get a popup with all of your bot's vitals.

Includes revised "inventory list" as well as revised "list".

So now we would have bot inspection for inventory purposes, a listing via popup for slot reference, a stat listing. The only problem you might have with the diff is that I pulled out all of the chat messages being sent to the client for inventory lists. This kinda kills the item links as they do not work with the popups (yet? dunno if it is even possible. Bogus data is being sent to highlight the item in the popup).

Plus, yea, the popups are kinda no-frills.

Anyway, here it is:


@@ -8479,7 +8479,7 @@

if(!strcasecmp(sep->arg[1], "list")) {
bool listAll = true;
- int iClass = atoi(sep->arg[2]);
+ uint16 iClass = (uint16) atoi(sep->arg[2]);

if(iClass > 0 && iClass < 17)
listAll = false;
@@ -8492,15 +8492,19 @@
}

if(!AvailableBots.empty()) {
+ std::stringstream botListStringStream;
for(std::list<BotsAvailableList>::iterator TempAvailable
BotsList = AvailableBots.begin(); TempAvailableBotsList != AvailableBots.end();
TempAvailableBotsList++) {
if(listAll) {
- c->Message(0, "ID: %u -- Class: %s -- Na
me: %s -- Race: %s", TempAvailableBotsList->BotID, ClassIdToString(TempAvailable
BotsList->BotClass).c_str(), TempAvailableBotsList->BotName, RaceIdToString(Temp
AvailableBotsList->BotRace).c_str());
+ botListStringStream <<"ID: " << TempAvai
lableBotsList->BotID << " " << TempAvailableBotsList->BotName << " " << RaceIdTo
String(TempAvailableBotsList->BotRace) << " " << ClassIdToString(TempAvailableBo
tsList->BotClass) << "<br>";
+ //c->Message(0, "ID: %u -- Class: %s --
Name: %s -- Race: %s", TempAvailableBotsList->BotID, ClassIdToString(TempAvailab
leBotsList->BotClass).c_str(), TempAvailableBotsList->BotName, RaceIdToString(Te
mpAvailableBotsList->BotRace).c_str());
}
else {
if(TempAvailableBotsList->BotClass == iC
lass)
- c->Message(0, "ID: %u -- Class:
%s -- Name: %s -- Race: %s", TempAvailableBotsList->BotID, ClassIdToString(TempA
vailableBotsList->BotClass).c_str(), TempAvailableBotsList->BotName, RaceIdToStr
ing(TempAvailableBotsList->BotRace).c_str());
+ botListStringStream <<"ID: " <<
TempAvailableBotsList->BotID << " " << TempAvailableBotsList->BotName << " " <<
RaceIdToString(TempAvailableBotsList->BotRace) << " " << ClassIdToString(TempAva
ilableBotsList->BotClass) << "<br>";
+ //c->Message(0, "ID: %u -- Class
: %s -- Name: %s -- Race: %s", TempAvailableBotsList->BotID, ClassIdToString(Tem
pAvailableBotsList->BotClass).c_str(), TempAvailableBotsList->BotName, RaceIdToS
tring(TempAvailableBotsList->BotRace).c_str());
}
}
+ c->SendPopupToClient("Available Bots", botListStringStre
am.str().c_str());
}
else {
c->Message(0, "You have no bots created. Use the #bot cr
eate command to create a bot.");
@@ -9105,7 +9109,47 @@

return;
}
-
+ if(!strcasecmp(sep->arg[1], "stats"))
+ {
+ if(c->GetTarget() != NULL)
+ {
+ if(c->GetTarget()->IsBot() && c->GetTarget()->CastToBot(
)->GetBotOwnerCharacterID() == c->CharacterID())
+ {
+ std::stringstream botStatStream;
+ Bot *b = c->GetTarget()->CastToBot();
+ botStatStream
+ << b->GetName() << "<BR>"
+ << ClassIdToString(b->CastToBot()->GetClass()) <
< "<BR><BR>"
+ << "Hp: " << b->GetHP() << "/" << b->GetMaxHP()
<< "<BR>"
+ << "Mana: " << b->GetMana() << "/" << b->GetMaxM
ana() << "<BR>"
+ << "AC: " << b->GetAC() << "<BR>"
+ << "ATK: " << b->GetATK() << "<BR>"
+ << "STR: " << b->GetSTR() << "<BR>"
+ << "STA: " << b->GetSTA() << "<BR>"
+ << "AGI: " << b->GetAGI() << "<BR>"
+ << "DEX: " << b->GetDEX() << "<BR>"
+ << "INT: " << b->GetINT() << "<BR>"
+ << "WIS: " << b->GetWIS() << "<BR>"
+ << "CHA: " << b->GetCHA() << "<BR>"
+ << "<BR>"
+ << "Resists" << "<BR>"
+ << "Magic: " << b->GetMR() << "<BR>"
+ << "Fire: " << b->GetFR() << "<BR>"
+ << "Cold: " << b->GetCR() << "<BR>"
+ << "Poison: " << b->GetPR() << "<BR>"
+ << "Disease: " << b->GetDR() << "<BR>";
+ c->SendPopupToClient("Bot Statistics", botStatSt
ream.str().c_str());
+ }
+ else //bot does not belong to client
+ {
+ c->Message(15, "This bot does not belong to you.
");
+ }
+ }
+ else //no client target
+ {
+ c->Message(15, "You must target a bot first.");
+ }
+ }
if(!strcasecmp(sep->arg[1], "inventory") && !strcasecmp(sep->arg[2], "li
st"))
{
if(c->GetTarget() != NULL)
@@ -9125,6 +9169,7 @@
"Left Finger", "Right Finger", "Chest",
"Legs", "Feet", "Waist", "Ammo" };
const Item_Struct* item2 = NULL;
bool is2Hweapon = false;
+ std::stringstream botInventoryPopupString;
for(int i=0; i<22 ; i++)
{
if((i == 14) && is2Hweapon) {
@@ -9138,7 +9183,8 @@
return;
}
if(item2 == 0) {
- c->Message(15, "I need something
for my %s (Item %i)", equipped[i], i);
+ botInventoryPopupString << equip
ped[i] << "[SlotID: " << i << "]->empty<BR>";
+ //c->Message(15, "I need somethi
ng for my %s (Item %i)", equipped[i], i);
continue;
}
if((i == 13) && ((item2->ItemType == Ite
mType2HS) || (item2->ItemType == ItemType2HB) || (item2->ItemType == ItemType2HP
ierce))) {
@@ -9147,24 +9193,26 @@
if((i == 0) || (i == 11) || (i == 13) ||
(i == 14) || (i == 21)) {
if (c->GetClientVersion() == EQC
lientSoF)
{
- c->Message(15, "Using %c
%06X00000000000000000000000000000000000000000000%s %c in my %s (Item %i)", 0x12,
item2->ID, item2->Name, 0x12, equipped[i], i);
+ botInventoryPopupString
<< equipped[i] << "[SlotID: " << i << "]-><a WndNotify=" << '"' << "27,00" << '"
' << ">" << item2->Name << "</a><br>";

}
else
{
- c->Message(15, "Using %c
%06X000000000000000000000000000000000000000%s%c in my %s (Item %i)", 0x12, item2
->ID, item2->Name, 0x12, equipped[i], i);
+ botInventoryPopupString
<< equipped[i] << "[SlotID: " << i << "]-><a WndNotify=" << '"' << "27,00" << '"
' << ">" << item2->Name << "</a><br>";

}
}
else {
if (c->GetClientVersion() == EQC
lientSoF)
{
- c->Message(15, "Using %c
%06X00000000000000000000000000000000000000000000%s %c on my %s (Item %i)", 0x12,
item2->ID, item2->Name, 0x12, equipped[i], i);
+ botInventoryPopupString
<< equipped[i] << "[SlotID: " << i << "]-><a WndNotify=" << '"' << "27,00" << '"
' << ">" << item2->Name << "</a><br>";
+
}
else
{
- c->Message(15, "Using %c
%06X000000000000000000000000000000000000000%s%c on my %s (Item %i)", 0x12, item2
->ID, item2->Name, 0x12, equipped[i], i);
+ botInventoryPopupString
<< equipped[i] << "[SlotID: " << i << "]-><a WndNotify=" << '"' << "27,00" << '"
' << ">" << item2->Name << "</a><br>";

}
- }
- }
+ }

+ }
+ c->SendPopupToClient(b->CastToBot()->GetName(),
botInventoryPopupString.str().c_str());
}
else {
c->Message(15, "You must group your bot first.")
;