Gems sell for $0?

Put your bugs you find in osRose here

Moderators: osRose dev team, ospRose dev team, osiRose dev team, Moderators

Gems sell for $0?

Postby xSLaYaHx on Sun Oct 28, 2007 3:28 am

I just sold a Ruby [7] which should have sold for 220k, but on worldserver.exe, it shows Price: 0. Any fix?
xSLaYaHx
Smoulie
Smoulie
 
Posts: 67
Joined: Mon Sep 24, 2007 4:20 am

Re: Gems sell for $0?

Postby zenbog on Sun Oct 28, 2007 6:22 am

I have noticed this also for at least the last few Rev's, I thought it was what the dev's wanted to do in order to keep from exploiting the sale of gems for zuly, but i might be wrong :?
Zenbog
User avatar
zenbog
Jelly Bean
Jelly Bean
 
Posts: 10
Joined: Thu Aug 09, 2007 1:04 am
Location: Jackson, MS. USA

Re: Gems sell for $0?

Postby Geobot on Sun Oct 28, 2007 12:15 pm

what revision do you have? it works fine on mine. is it just for gems or do other items do that same thing? if it's just gems, take a look a jemitem_data.csv. are the prices right in the 'price' column? are there 10's in the 'pricerate' column?
Image
User avatar
Geobot
Antares
Antares
 
Posts: 342
Joined: Mon Oct 01, 2007 7:38 am

Re: Gems sell for $0?

Postby zenbog on Sun Oct 28, 2007 4:52 pm

I am using Rev 80, the last time I looked at any of those I saw prices on gem's and the 10's but still got zero zuly. As far as I can tell it just happens on gem's. I will double check this, after work today.

[EDIT]
checked a G1 and it said $8,xxx zuly in sell window, but gave no money, checked the jemitem_data.csv it has
id: 301
type: 411
price: 10200
pricerate: 10
weight: 1
quality: 30
material: 1201
stat1: 11|1
stat2: 0|0

these two prices don't match, could this cause the gem sale to be zero ?
Zenbog
User avatar
zenbog
Jelly Bean
Jelly Bean
 
Posts: 10
Joined: Thu Aug 09, 2007 1:04 am
Location: Jackson, MS. USA

Re: Gems sell for $0?

Postby xSLaYaHx on Sun Oct 28, 2007 7:19 pm

I have the same problem. I think its the STB's causing the problem
xSLaYaHx
Smoulie
Smoulie
 
Posts: 67
Joined: Mon Sep 24, 2007 4:20 am

Re: Gems sell for $0?

Postby Geobot on Sun Oct 28, 2007 11:51 pm

ok, i found the problem, but i'm not going to fix it because i don't know the formula for actually calulating the price(it's more than just grabbing it from the database).

in worldpackets.cpp, function pakNPCbuy:
  1.  case 7:
  2.             case 11:
  3.             case 13:
  4.             {
  5.                 float price = 0;
  6.                 UINT bprice = 0;
  7.                 UINT pricerate = 0;
  8.                 switch(thisitem.itemtype)
  9.                 {
  10.                     case 7:              
  11.                         pricerate = EquipList[thisitem.itemtype].Index[thisitem.itemnum]->pricerate;
  12.                         bprice *= EquipList[thisitem.itemtype].Index[thisitem.itemnum]->price;                
  13.                     break;
  14.                     case 11:
  15.                         pricerate = JemList.Index[thisitem.itemnum]->pricerate;
  16.                         bprice *= JemList.Index[thisitem.itemnum]->price;              
  17.                     break;
  18.                     case 13:continue;//can we sell quest items? :S
  19.                        
  20.                 }      
  21.                 price = pricerate;    
  22.                 price *= 0x61 - 0x32;   // misc rate -0x32  
  23.                 price += 1000;
  24.                 price *= bprice;                                  
  25.                 price *= (200 - 0x62); //town rate ( 100)
  26.                 price *= 5.555555555555556E-06;                  
  27.                 price = (float)floor(price);          
  28.                 Log( MSG_WARNING, "Item Sold: itemnum %i, itemtype %i, itemcount %i, price %0.0f", thisitem.itemnum, thisitem.itemtype, thisitem.count, price);                                                                            
  29.                 thisclient->CharInfo->Zulies += (long int)price*count;                    
  30.          


this is the part that gets the sell prices for gems and accessories.

near the top, it initializes 'bprice' as zero. after that it multiplies 'bprice' by the price in the CSV, but it's still zero, since it started at zero, and multiplication does that.

then when 'price' gets multiplied by 'bprice' further down, it zeros it too, and screws up the whole thing, making the end price zero for every gem and accessory.

i'm assuming you could just change these lines:
  1. bprice *= EquipList[thisitem.itemtype].Index[thisitem.itemnum]->price;                
  2. bprice *= JemList.Index[thisitem.itemnum]->price;              


to:
  1. bprice = EquipList[thisitem.itemtype].Index[thisitem.itemnum]->price;                
  2. bprice = JemList.Index[thisitem.itemnum]->price;              


to assign them instead of multiplying them, but it's hard for me to test since i don't run rev 80. and besides, assumption is evil, and should be tested. but that's what i figure the problem is, just makes sense.
Image
User avatar
Geobot
Antares
Antares
 
Posts: 342
Joined: Mon Oct 01, 2007 7:38 am

Re: Gems sell for $0?

Postby PurpleYouko on Mon Oct 29, 2007 2:09 pm

In my revision it is completely different so we don't have this problem.
here is the code used in mine. I think this comes from rev 64.
  1.  
  2. case 7:
  3.                 case 11:
  4.                 case 13:
  5.                 {
  6.                     float price = 0;
  7.                     UINT bprice = 0;
  8.                     UINT pricerate;
  9.                     if(thisitem.itemtype==7)
  10.                     {
  11.                         pricerate = EquipList[7].Index[thisitem.itemnum]->pricerate;
  12.                         bprice = EquipList[7].Index[thisitem.itemnum]->price;
  13.                     }
  14.                     else
  15.                     {
  16.                         switch(thisitem.itemtype)
  17.                         {
  18.                             case 11:
  19.                                 pricerate = JemList.Index[thisitem.itemnum]->pricerate;
  20.                                 bprice = JemList.Index[thisitem.itemnum]->price;                                
  21.                             break;
  22.                             case 13:continue;
  23.                         }
  24.                     }    
  25.                     price = pricerate;                              
  26.                     unsigned int value = 0x61 - 0x32; // misc rate - 0x32                    
  27.                     price *= value;                
  28.                     price *= 0.001;
  29.                     price += 1;  
  30.                     price *= bprice;                                              
  31.                     price += 0.5;
  32.                     price = (float)round(price);
  33.                     if(thisclient->CharInfo->Zulies < (long int)price)
  34.                         return true;          
  35.                     Log( MSG_WARNING, "Item bought: itemnum %i, itemtype %i, itemcount %i, price %0.0f", thisitem.itemnum, thisitem.itemtype, thisitem.count, price);                                                                              
  36.                     thisclient->CharInfo->Zulies -= (long int)price*count;                    
  37.                 }
  38.                 break;
Need to lookup information on NARose items, skills, quests?
Now featuring a newly completed skill tree for all classes
Formatting fixed for different resolutions
Image

"A Gazelle is nothing but a giraffe plotted logarithmicaly"
User avatar
PurpleYouko
Rose Guru
Rose Guru
 
Posts: 4733
Joined: Fri Aug 10, 2007 2:05 pm

Re: Gems sell for $0?

Postby Geobot on Mon Oct 29, 2007 2:20 pm

yea, mine looks the same way, and i believe mine was originally rev74. not sure when the change was made.
Image
User avatar
Geobot
Antares
Antares
 
Posts: 342
Joined: Mon Oct 01, 2007 7:38 am

Re: Gems sell for $0?

Postby lmame on Tue Oct 30, 2007 9:18 am

As geobot pointed it out, it's a bug :)

in file worldpackets.cpp:
REPLACE:
  1.  
  2. bprice *= EquipList[thisitem.itemtype].Index[thisitem.itemnum]->price;              
  3.  


BY:
  1.  
  2. bprice = EquipList[thisitem.itemtype].Index[thisitem.itemnum]->price;                
  3.  



REPLACE:
  1.  
  2. bprice *= JemList.Index[thisitem.itemnum]->price;
  3.  


BY:
  1.  
  2. bprice = JemList.Index[thisitem.itemnum]->price;
  3.  


And try again.


@zenbog:
There can be an abuse as there is no anti hack check on those kind of things. Though they'll be in the next rev ;)
The world is full of love and peace ^_^
Image
User avatar
lmame
Admin
Admin
 
Posts: 8997
Joined: Mon Aug 06, 2007 4:42 pm
Location: July City


Return to Bugs

Who is online

Users browsing this forum: No registered users and 1 guest

cron