This is a read only copy without any forum functionality of the old Modcraft forum.
If there is anything that you would like to have removed, message me on Discord via Kaev#5208.
Big thanks to Alastor for making this copy!

Menu

Author Topic: [SOLVED] Barbershop Prices  (Read 3245 times)

Milly

  • Contributors
  • Creator of Worlds
  • *****
  • Posts: 503
    • View Profile
[SOLVED] Barbershop Prices
« on: March 29, 2013, 05:10:51 am »
Hi everyone,

I'm working on an RP server and I feel it would be ideal if my players can use the barbershop for free. I have made the proper clientside and serverside modifications to BarberShopStyle.dbc. That didn't work so I had to edit the core (player.cpp) and set the cost values to 0 gold. This did in fact work, but only for Hair Styles and Facial Hair. For some reason, Hair Color is still listed in-game as costing 5 gold.

However, if I buy a Hair Style and Hair Color at the same time, it costs 0 gold. But trying to buy a Hair Color alone will say it costs 5 gold and won't allow me to buy it because I don't have enough money. But if I do have enough money, it applies the new hair color without removing gold from my inventory. Meaning the hair color issue is client-side, not server-side. Unless I'm mistaken.

Basically I'm wondering if anyone might know what I have to modify client-side to remove the cost of hair colors, or if it's even possible. I understand that I can just give everyone 10 gold and they'll never have to worry about it, but I'd like to make things look nice and of high standard.

Also, just so you know, this isn't a cache issue. And I have tested BarberShopStyle.dbc and it doesn't appear to have any relation to hair colors at all, so the value must be hidden somewhere else. I just can't find it and after 5+ hours of looking, it starts to frustrate me.

Thanks

More info: Latest TrinityCore, 3.3.5a
P.S. I'm finally back from hiatus, if anyone cares. :)
« Last Edit: March 30, 2013, 01:28:42 am by Admin »

schlumpf

  • Administrator
  • Creator of Worlds
  • *****
  • Posts: 2967
    • View Profile
Re: [QUESTION] Barbershop Prices
« Reply #1 on: March 29, 2013, 11:36:26 am »
It might be fixable by removing price related stuff from the lua scripts and XML files. That will also result in being prettier as they won't ever see prices.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Ascathos

  • Moderators
  • Creator of Worlds
  • *****
  • Posts: 1129
    • View Profile
Re: [QUESTION] Barbershop Prices
« Reply #2 on: March 29, 2013, 06:22:45 pm »
After some own attempts, it always fails on the money output. It seems to have some hardcoded-in elements.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Milly

  • Contributors
  • Creator of Worlds
  • *****
  • Posts: 503
    • View Profile
Re: [QUESTION] Barbershop Prices
« Reply #3 on: March 29, 2013, 07:26:21 pm »
Good idea about removing money all-together schlumpf. And thanks for the effort Ascathos.

I got into the FrameXML files for MoneyFrame and MoneyInput, and no matter how I tinkered with them they still had no effect on the cost value. I've even commented out the entire code for those files, and all it did was make money invisible. Which is cool and all, and I might consider doing something like that in the future (without destroying the entire code of course), but it doesn't solve the problem necessarily.

I also did some windows file searches to find every occurrence of keywords like barber, hair, cost, price, etc. This brought back zero results when done on the FrameXML and GlueXML files. Soo it's just not there =

Think there's anywhere else worth checking before considering this an impossible task?
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Ascathos

  • Moderators
  • Creator of Worlds
  • *****
  • Posts: 1129
    • View Profile
Re: [QUESTION] Barbershop Prices
« Reply #4 on: March 29, 2013, 07:36:01 pm »
Concerning the serverside changes.

Code: [Select]
   GtBarberShopCostBaseEntry const* bsc = sGtBarberShopCostBaseStore.LookupEntry(level - 1);

    if (!bsc)                                                // shouldn't happen
        return 0xFFFFFFFF;

    float cost = 0;

    if (hairstyle != newhairstyle)
        cost += bsc->cost;                                  // full price

    if ((haircolor != newhaircolor) && (hairstyle == newhairstyle))
        cost += bsc->cost * 0.5f;                           // +1/2 of price

    if (facialhair != newfacialhair)
        cost += bsc->cost * 0.75f;                          // +3/4 of price

    if (newSkin && skincolor != newSkin->hair_id)
        cost += bsc->cost * 0.75f;                          // +5/6 of price

It takes the costs from the barbier file and uses it. If it is set to 0, it wshouldn't take money.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Milly

  • Contributors
  • Creator of Worlds
  • *****
  • Posts: 503
    • View Profile
Re: [QUESTION] Barbershop Prices
« Reply #5 on: March 29, 2013, 07:40:45 pm »
That is what I did, and I compiled about 8 times or so with different values and entries to try and get it to work. You're right, it doesn't take money. However, the player's client still says that Hair Color costs 5 gold (it doesn't actually cost that money, but the client thinks it does). So unless you already have 5 gold in your inventory, your client will still say you don't have enough money to afford it. But if you do have the money, you get it for free.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

schlumpf

  • Administrator
  • Creator of Worlds
  • *****
  • Posts: 2967
    • View Profile
Re: [QUESTION] Barbershop Prices
« Reply #6 on: March 29, 2013, 07:44:00 pm »
Code: [Select]
       cost += bsc->cost * 0.75f;                          // +5/6 of priceOh, the joy of comments being not helpful but wrong.

MoneyFrame is only the pure display and is used for bags etc as well. You should modify the barbershop interface itself. Something enables and disables the button there. And shows the price.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Milly

  • Contributors
  • Creator of Worlds
  • *****
  • Posts: 503
    • View Profile
Re: [QUESTION] Barbershop Prices
« Reply #7 on: March 29, 2013, 08:57:08 pm »
Silly me, no wonder I couldn't find the BarbershopUI. Didn't realize it was an AddOn. I tried it out and was able to make it say that Hair Color only costs 0 gold, but that's just visual and doesn't actually change the true client-side cost. Anyways, I've been tampering with it for a while now and from my very little understanding of the code, the "Okay" button seems to be connected to a script/function/whatever called ApplyBarberShopStyle.

Code: [Select]
<Button name="$parentOkayButton" inherits="UIPanelButtonTemplate" text="OKAY">
<Size>
<AbsDimension x="80" y="24"/>
</Size>
<Anchors>
<Anchor point="RIGHT" relativeTo="$parentSelector3" relativePoint="BOTTOM">
<Offset>
<AbsDimension x="-2" y="-48"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnClick function="ApplyBarberShopStyle"/>
</Scripts>
</Button>
Any ideas where I can find this "ApplyBarberShopStyle" function and edit it? It's not in the BarbershopUI, unless it's hidden in BLIZZARD_BARBERSHOPUI.TOC.SIG but I can't even read that file in NotePad++

Edit: Nevermind about BLIZZARD_BARBERSHOPUI.TOC.SIG, apparently it's a file format for holding images or something to do with e-mail signatures. Unless Blizzard uses a different kind.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

schlumpf

  • Administrator
  • Creator of Worlds
  • *****
  • Posts: 2967
    • View Profile
Re: [QUESTION] Barbershop Prices
« Reply #8 on: March 29, 2013, 11:30:49 pm »
It should be in the lua file?
.sig is indeed signatures; file validation signatures.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Milly

  • Contributors
  • Creator of Worlds
  • *****
  • Posts: 503
    • View Profile
Re: [QUESTION] Barbershop Prices
« Reply #9 on: March 30, 2013, 12:01:47 am »
As far as I'm understanding, it isn't defined as a function in the Blizzard_BarberShopUI.lua.

http://pastebin.com/3H5sEEnu
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

schlumpf

  • Administrator
  • Creator of Worlds
  • *****
  • Posts: 2967
    • View Profile
Re: [QUESTION] Barbershop Prices
« Reply #10 on: March 30, 2013, 12:14:40 am »
Ah, sorry.
It is an API function, just like most of barbershop: http://wowprogramming.com/docs/api_categories#barber
Same goes for calculating the price. One would need to reverse engineer those functions. I'd guess the 5g is a base price depending on level, though, which is hardcoded and not configurable.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Milly

  • Contributors
  • Creator of Worlds
  • *****
  • Posts: 503
    • View Profile
Re: [QUESTION] Barbershop Prices
« Reply #11 on: March 30, 2013, 12:31:31 am »
Damn that's a bummer. I suppose it can't be helped.

I'm just going to entirely remove the money frame from the BarberShopUI and have players start off with enough gold to satisfy the client's retarded Hair Color needs. It still feels a little incomplete but at least it isn't visible.

Thanks for all the help schlumpf, I appreciate it.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Ascathos

  • Moderators
  • Creator of Worlds
  • *****
  • Posts: 1129
    • View Profile
Re: [QUESTION] Barbershop Prices
« Reply #12 on: March 30, 2013, 03:06:34 pm »
Quote from: "Xapzi"
Damn that's a bummer. I suppose it can't be helped.

I'm just going to entirely remove the money frame from the BarberShopUI and have players start off with enough gold to satisfy the client's retarded Hair Color needs. It still feels a little incomplete but at least it isn't visible.

Thanks for all the help schlumpf, I appreciate it.
Alternatively, add 5 gold on usage to the player. So there is no abuse possible. They just need 5 gold.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

schlumpf

  • Administrator
  • Creator of Worlds
  • *****
  • Posts: 2967
    • View Profile
Re: [SOLVED] Barbershop Prices
« Reply #13 on: March 31, 2013, 04:01:43 am »
Nah, that can't be the solution. To the bathroom!
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

schlumpf

  • Administrator
  • Creator of Worlds
  • *****
  • Posts: 2967
    • View Profile
Re: [SOLVED] Barbershop Prices
« Reply #14 on: March 31, 2013, 04:08:42 am »
Actual solution: BarberShopCostBase. Game tables. That's where your 5g come from.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »