it's probably in the params (opcode 249) of the itemdefinition
|
Does anyone know how to get the sell price from shops? My guess its coming from the cache so i looked in my ItemDefinitions and nothing is there for it. If someone knows a way to find where it pulls from or better yet the code to use it in Shops.java.
NOTE: This is not the buy price from item.getDefinitions().getValue()
EDIT: I know a lot of the items sold back to the vender is buyPrice / 3.333333 but some items like air staff's and other items have different sell prices that are loaded in the shop interface
This is sell interface where it shows the sell price:
Last edited by _Will; 10-15-2019 at 11:30 AM.
it's probably in the params (opcode 249) of the itemdefinition
I assume by sell price you mean the value it's showing under the item icon.
This is done via the cache, yes.
I checked the opcode 249 and its already used for client script data. Not sure if thats the right opcode. I tried sysout ing the data and got a bunch of random numbers and text.
This the opcode used
Code:} else if (opcode == 249) { int length = stream.readUnsignedByte(); if (clientScriptData == null) clientScriptData = new HashMap<Integer, Object>(length); for (int index = 0; index < length; index++) { boolean stringInstance = stream.readUnsignedByte() == 1; int key = stream.read24BitInt(); Object value = stringInstance ? stream.readString() : stream .readInt(); clientScriptData.put(key, value); System.out.println(clientScriptData.get(key)); }
When launching server it sent a bunch text like this:
Code:Remove 6000 18000 1 Activate aura Aura time remaining Remove 6000 18000 1 Activate aura Aura time remaining Remove 6000 24000 1 10 10 10 10 10 5
if it's not in params, id just try to look into the cs2 script and find out where it gets the value from
Its cache sided you will have to repack all the item values, I used to have a program that did all of them for me but sadly I moved on from 718 or I would give it to you. I may have some code laying around I might have changed where it reads from later on in my development if I did and I find it I will pm you or edit this for your answer just give me a day or so.
Here are the scripts that decides the item price:
Code:[proc,buyprice](obj $obj0)(int) if ($obj0 = null) { return(0); } $obj0 = oc_uncert($obj0); def_int $int1 = enum(obj, int, 731, $obj0); if (%var532 = 6529 & $int1 ! -1 & $int1 > 0) { return($int1); } $int1 = enum(obj, int, 733, $obj0); if ($int1 ! -1 & $int1 > 0) { return($int1); } if (oc_param($obj0, 258) = 1 | oc_param($obj0, 259) = 1) { return(99000); } $int1 = oc_cost($obj0); if (%var532 = 6529) { $int1 = scale(3, 2, $int1); } return(max($int1, 1));In-case you don't know, enums are in index 17 more commonly known as CSMap(s) in Matrix based servers. OC is object config which is ItemDefinition in Matrix, varps are just sendConfig in Matrix.Code:[proc,sellprice](obj $obj0)(int) if ($obj0 = null) { return(0); } $obj0 = oc_uncert($obj0); def_int $int1 = enum(obj, int, 732, $obj0); if (%var532 = 6529 & $int1 ! -1) { return($int1); } $int1 = enum(obj, int, 1441, $obj0); if ($int1 ! -1 & $int1 > 0) { return($int1); } $int1 = max(1, scale(oc_cost($obj0), 100, 30)); return($int1);
Sorry none of this code makes sense to me and I don't think this is correct either. I tried importing ur code but it looks not even java.
I use this currently to get close to the sale price but its not accurate for all items. For example air staffs buy price is 1500 and sell price is 20. But most other item is just 50% less than high alch price, which is the same as 30% of cache price.
If you look at the prices on zaffs staff shop it shows the different sell and buy prices. This is the same prices for rs3 and matrix rsps btw:
https://runescape.wiki/w/Zaff%27s_Superior_Spellcasting
It would be awesome if you can find the code to pack them or atleast the file filled with the correct prices. But If you cant please try to explain to me how to pack them. By that you mean like pack them into a txt file right? Couldn't this be done without putting them into a txt file and code them straight in pulling from cache?
The code is 100% correct since it is taken from the cache directly, however, if it doesn't make sense to you then :/ I will try to explain it in short, the price is determined in multiple places:
1. For the buy price of the runes, most of them, they are in CSMap 731 (Enum 731)
2. For the sell price of the Death Rune and Chaos Rune, they are in CSMap 732 (Enum 732)
3. For the sell price of Staff of Air, Charge bow, Spirit shards, and Spirit shard pack, they are in CSMap 1441 (Enum 1441)
4. A lot of the farming items and some additional items are in CSMap 733 (Enum 733)
5. For the rest of the items, the are located in item definitions cost opcode (value)
If it is none of these, your item's value must have been hardcoded somewhere in the client.
« Previous Thread | Next Thread » |
Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |