EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Support::Windows Servers (https://www.eqemulator.org/forums/forumdisplay.php?f=587)
-   -   Silly bot question (https://www.eqemulator.org/forums/showthread.php?t=38585)

Nightrider84 08-08-2014 02:44 PM

Silly bot question
 
stupid question but when I spawn a bot depending on the class and race they dont have armor or anything to start but it shows them wearing armor. anyway to set it so they look naked when spawned?

Uleat 08-08-2014 04:32 PM

If you could give me a few combo examples, I'll take a look at it.

Kingly_Krab 08-08-2014 04:48 PM

I've noticed this as well, it seems Barbarians spawn with a chain chest texture and a plate helmet texture, I'm sure there are others, but this is just something I saw when I was messing around on a server for a couple of minutes last night.


EDIT: It seems in bot.cpp the texture is set on spawn to 0xFF, I'm not sure why it would give the appearance of chain and plate though:
Code:

void Bot::Spawn(Client* botCharacterOwner, std::string* errorMessage) {
    if(GetBotID() > 0 && _botOwnerCharacterID > 0 && botCharacterOwner && botCharacterOwner->CharacterID() == _botOwnerCharacterID) {
        // Rename the bot name to make sure that Mob::GetName() matches Mob::GetCleanName() so we dont have a bot named "Jesuschrist001"
        strcpy(name, GetCleanName());

        // Get the zone id this bot spawned in
        _lastZoneId = GetZoneID();

        this->helmtexture = 0xFF;
        this->texture = 0xFF;

Also the same thing in the bot commands in bot.cpp:
Code:

if(!strcasecmp(sep->arg[1], "haircolor") || !strcasecmp(sep->arg[1], "hair") || !strcasecmp(sep->arg[1], "beard") || !strcasecmp(sep->arg[1], "beardcolor") || !strcasecmp(sep->arg[1], "face")
        || !strcasecmp(sep->arg[1], "eyes") || !strcasecmp(sep->arg[1], "heritage") || !strcasecmp(sep->arg[1], "tattoo") || !strcasecmp(sep->arg[1], "details")) {
        if(c->GetTarget() && c->GetTarget()->IsBot()) {
            if (sep->IsNumber(2)) {
                if (c->GetTarget()->CastToBot()->GetBotOwnerCharacterID() == c->CharacterID()) {
                    Bot *target = c->GetTarget()->CastToBot();
                    uint16 Race = target->GetRace();
                    uint8 Gender = target->GetGender();
                    uint8 Texture = 0xFF;
                    uint8 HelmTexture = 0xFF;


Uleat 08-08-2014 04:59 PM

I know there are some model update issues..I have a posting somewhere..sec...

http://www.eqemulator.org/forums/showthread.php?t=36819


It may, or may not, be related..but, I can put it back on the short list to look at.

Nightrider84 08-09-2014 12:04 AM

the troll shaman has a full set of armor on thats all different colors. just to give an example. also almost every bot race/class I spawn no matter what client im on has a chest piece of some sort on them.

Uleat 08-12-2014 06:01 PM

I did some in-game testing on 'nude' bots using the current code base.


Ti (6.2?) does not show this issue..
SoF thru UF show this issue..
RoF shows this issue and the #wc command will not change it...


I agree with what Kingly_Krab pointed out as being the problem..though, I'd like to look a little deeper into before pushing a fix.

I suspect that something changed in between Ti and SoF..but, it could also be something in our code. Either way, I need to verify that the
translators will pass the change correctly.


Part of the problem is that we treat bots as npcs..and then tell the client that they're other clients... We just need to ensure that
we pass on relevant data as client-based and not npc-based.

Nightrider84 08-12-2014 06:58 PM

thank you for taking the time to look into it. I noticed no issues in Titanium aswell. Im looking forward to a hopeful fix in the near future =)

Uleat 08-13-2014 02:22 PM

The 'default' chest armor graphic is fix is committed..but, I forgot to see if I could force armor glitches in other slots.


Hopefully, this will fix all of that mess..but, please post back if you see anymore bot model glitches.


EDIT: I went back and checked a few items with RoF..and, it does appear to have corrected that issue from the
items I tested with.

Nightrider84 08-14-2014 04:17 PM

Applied the graphics fix. seems to have fixed the chest piece but still getting the "dyed" armor effect in other slots. half way there thow =P
Also the slots that look dyed on the bots don't have any items equipped on them. they just spawn like that when you create the bot.
Create a troll shaman and you will see what I mean =)

Uleat 08-14-2014 05:03 PM

Yeah, I tested with the only combinations I could remember and with what was in that bug link post..my desktop went nuclear earlier this year and
I lost a lot of notes I had on the issue...

I don't know about spawning issues..but, I do remember it being prevalent when removing armor..the armor model would stay the same, but,
turn green :/


This is still on my short list..I don't want to have to re-open that bug thread :P

Nightrider84 08-14-2014 05:43 PM

I think its too late for that :p

Uleat 08-14-2014 06:28 PM

There are 2 ways to send initial spawn data..


1) When a player zones in and all existing mobs are sent..

2) When a player is in-zone and a mob is spawned..


Do you remember if these glitches show up on both spawn actions?

Kingly_Krab 08-14-2014 09:01 PM

Seems that armor color is sent in Bot::FillSpawnStruct:
Code:

void Bot::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) {
    if(ns) {
        Mob::FillSpawnStruct(ns, ForWho);

        ns->spawn.afk = 0;
        ns->spawn.lfg = 0;
        ns->spawn.anon = 0;
        ns->spawn.gm = 0;
        if(IsInAGuild())
            ns->spawn.guildID = GuildID();
        else
            ns->spawn.guildID = 0xFFFFFFFF;        // 0xFFFFFFFF = NO GUILD, 0 = Unknown Guild
        ns->spawn.is_npc = 0;                // 0=no, 1=yes
        ns->spawn.is_pet = 0;
        ns->spawn.guildrank = 0;
        ns->spawn.showhelm = 1;
        ns->spawn.flymode = 0;
        ns->spawn.size = 0;
        ns->spawn.NPC = 0;                    // 0=player,1=npc,2=pc corpse,3=npc corpse

        ns->spawn.helm = helmtexture; //0xFF;
        ns->spawn.equip_chest2 = texture; //0xFF;

        const Item_Struct* item = 0;
        const ItemInst* inst = 0;

        uint32 spawnedbotid = 0;
        spawnedbotid = this->GetBotID();

        inst = GetBotItem(MainHands);
        if(inst) {
            item = inst->GetItem();
            if(item) {
                ns->spawn.equipment[MaterialHands]    = item->Material;
                ns->spawn.colors[MaterialHands].color = GetEquipmentColor(MaterialHands);
            }
        }

        inst = GetBotItem(MainHead);
        if(inst) {
            item = inst->GetItem();
            if(item) {
                ns->spawn.equipment[MaterialHead] = item->Material;
                ns->spawn.colors[MaterialHead].color = GetEquipmentColor(MaterialHead);
            }
        }

        inst = GetBotItem(MainArms);
        if(inst) {
            item = inst->GetItem();
            if(item) {
                ns->spawn.equipment[MaterialArms] = item->Material;
                ns->spawn.colors[MaterialArms].color = GetEquipmentColor(MaterialArms);
            }
        }

        inst = GetBotItem(MainWrist1);
        if(inst) {
            item = inst->GetItem();
            if(item) {
                ns->spawn.equipment[MaterialWrist] = item->Material;
                ns->spawn.colors[MaterialWrist].color    = GetEquipmentColor(MaterialWrist);
            }
        }

        /*
        // non-live behavior
        inst = GetBotItem(MainWrist2);
        if(inst) {
            item = inst->GetItem();
            if(item) {
                ns->spawn.equipment[MaterialWrist] = item->Material;
                ns->spawn.colors[MaterialWrist].color    = GetEquipmentColor(MaterialWrist);
            }
        }
        */

        inst = GetBotItem(MainChest);
        if(inst) {
            item = inst->GetItem();
            if(item) {
                ns->spawn.equipment[MaterialChest]    = item->Material;
                ns->spawn.colors[MaterialChest].color = GetEquipmentColor(MaterialChest);
            }
        }

        inst = GetBotItem(MainLegs);
        if(inst) {
            item = inst->GetItem();
            if(item) {
                ns->spawn.equipment[MaterialLegs] = item->Material;
                ns->spawn.colors[MaterialLegs].color = GetEquipmentColor(MaterialLegs);
            }
        }

        inst = GetBotItem(MainFeet);
        if(inst) {
            item = inst->GetItem();
            if(item) {
                ns->spawn.equipment[MaterialFeet] = item->Material;
                ns->spawn.colors[MaterialFeet].color = GetEquipmentColor(MaterialFeet);
            }
        }

        inst = GetBotItem(MainPrimary);
        if(inst) {
            item = inst->GetItem();
            if(item) {
                if(strlen(item->IDFile) > 2)
                    ns->spawn.equipment[MaterialPrimary] = atoi(&item->IDFile[2]);
                    ns->spawn.colors[MaterialPrimary].color = GetEquipmentColor(MaterialPrimary);
            }
        }

        inst = GetBotItem(MainSecondary);
        if(inst) {
            item = inst->GetItem();
            if(item) {
                if(strlen(item->IDFile) > 2)
                    ns->spawn.equipment[MaterialSecondary] = atoi(&item->IDFile[2]);
                    ns->spawn.colors[MaterialSecondary].color = GetEquipmentColor(MaterialSecondary);
            }
        }
    }
}

And the code for Bot::GetEquipmentColor looks like this:
Code:

uint32 Bot::GetEquipmentColor(uint8 material_slot) const
{
    //Bot tints
    uint32 slotid = 0;
    uint32 returncolor = 0;
    uint32 botid = this->GetBotID();

    //Translate code slot # to DB slot #
    slotid = Inventory::CalcSlotFromMaterial(material_slot);

    //read from db
    char* Query = 0;
    MYSQL_RES* DatasetResult;
    MYSQL_ROW DataRow;

    if(database.RunQuery(Query, MakeAnyLenString(&Query, "SELECT color FROM botinventory WHERE BotID = %u AND SlotID = %u", botid, slotid), 0, &DatasetResult)) {
        if(mysql_num_rows(DatasetResult) == 1) {
            DataRow = mysql_fetch_row(DatasetResult);
            if(DataRow)
                returncolor = atoul(DataRow[0]);
        }
        mysql_free_result(DatasetResult);
        safe_delete_array(Query);
    }
    return returncolor;
}

In this the default is 0 which is what armor would be if the color of the armor in the database hadn't been set otherwise, which is weird as to why the bot's armor would have a green color with a value of 0. Is this done differently in for clients? Could this difference be causing the color issue? I'll need to look at the client color code to see, hope this helps a bit.

Edit: Maybe 0 isn't a good default value as 4278190080 shows as colorless or "white".

Uleat 08-14-2014 09:55 PM

Code:

ns->spawn.is_npc = 0;
...
ns->spawn.NPC = 0;

Older clients seem to use both in ENCODE(OP_ZoneSpawns)..

Underfoot uses 'NPC' only in zone spawns..'is_npc' only shows up in the illusion encode.

I'm not 100% on spawn structs and what mob types use which fields..but, I think all playable races should be using
equipment[0-8] for armor models, and non-playable use texture, helmtexture, etc... for armor models.


I still think it's related to how we identify bots as 'clients' to the client and are misusing some of the inital struct fields..but, it could be color.

The green only show up on an empty slot, not a properly occupied slot.

It retains the model of the removed item..but, in a green shade..possibly a transparency mask.
(rgb 0x00FF00 level brightness..no texture, only the painted surface)


I really just need to compare Ti vs. later clients translators to see what has changed..we may have a hard-coded unidentified field in the
spawn packet (like the 'is_npc' field)

Uleat 08-15-2014 04:28 PM

Ok, I reactivated some old code to get them working again. (I really narfled the garthok on that one, didn't I?)


I think you guys helped me to figure out what the problem was in my bug report..I just need to substantiate my theory now :shock:

(I did see what you meant about the 'green' on the Troll Shaman's loin cloth. This wasn't the same green that I was seeing in my
glitches..but, it was very helpful!)


All times are GMT -4. The time now is 09:26 PM.

Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.