|
You last visited: Today at 11:11
Advertisement
2 Questions, Selecting multiple coord & multiple inventory items
Discussion on 2 Questions, Selecting multiple coord & multiple inventory items within the CO2 Private Server forum part of the Conquer Online 2 category.
02/05/2013, 16:20
|
#1
|
elite*gold: 0
Join Date: Jan 2013
Posts: 24
Received Thanks: 0
|
2 Questions, Selecting multiple coord & multiple inventory items
Need a hand with 2 things ive been tryin to work out but not had much luck so far.
1:Took this example from mining which sets the specific map, But how can you set multiple coords on the map so the action can only been done when standing in those coords rather then the entire map?
Code:
switch (client.Entity.MapID)
{
case 1002:
{
Mine(700011, 700001, 700021, 700071, 1072010, 1072050, 1072031, 0, client);
break;
}
default:
{
client.Send(new Message("You cannot mine here. You must go inside a mine.", System.Drawing.Color.Red, Message.TopLeft));
client.Mining = false;
break;
}
2: Below is the basic code for selecting if someone has a certain amount of a specific item in there bag and there removing them, How would you go about checking if they had multiple different items between a certain item number range, Say between item numbers 10000 and 10010 but which ever they had as long as there combined amount = say 10 u would remove them from there inventory?
For Example you could have:
10000 x3
10003 x4
10009 x3
or
10001 x2
10003 x6
10007 x3
Code:
if (client.Inventory.Contains(723467, 10))
{
client.Inventory.Remove(723467, 10);
|
|
|
02/05/2013, 16:37
|
#2
|
elite*gold: 0
Join Date: Dec 2012
Posts: 1,761
Received Thanks: 950
|
1. Just do a conditional statement for checking the coords of the character.
Ex.
Code:
if (client.X == 400 && client.Y == 400)
{
// mine
}
2.
If itemids are in a range and there is no id skips then you could do something like this:
Code:
bool allmatch = true;
for (int itemid = 1000; i < 1010; i++)
{
if (!client.Inventory.Contains(itemid, 10))
allmatch = false;
}
if (allmatch)
{
// contains all
}
If you just want to remove based on that do:
Code:
for (int itemid = 1000; i < 1010; i++)
{
if (client.Inventory.Contains(itemid, 10);
client.Inventory.Remove(itemid, 10);
}
If the range does have skips then just do an array like:
Code:
uint[] itemids = new uint[]
{
1000,
1001,
1003
1010
};
foreach (int itemid in itemids)
{
if (client.Inventory.Contains(itemid, 10))
client.Inventory.Remove(itemid, 10);
}
And I could go on....
You get the idea.
|
|
|
02/05/2013, 16:38
|
#3
|
elite*gold: 0
Join Date: Jan 2013
Posts: 62
Received Thanks: 8
|
so what i understood is that you're trying to make a condition for a specific map coords,
if you want to check for 1 map,x,y you may use
PHP Code:
if (client.Entity.MapID == 1002 && client.Entity.X == 312 && client.Entity.Y == 121)
and for multiple ones, just duplicate the code and separate it by || which means "OR"
PHP Code:
if ((client.Entity.MapID == 1002 && client.Entity.X == 312 && client.Entity.Y == 121) || (client.Entity.MapID == 1002 && client.Entity.X == 322 && client.Entity.Y == 131) || (client.Entity.MapID == 1002 && client.Entity.X == 112 && client.Entity.Y == 121))
i don't know if this is what you're looking for, but i hope that this helped you
same idea for items
PHP Code:
if ((client.Inventory.Contains(ItemID, NUMBER) && (client.Inventory.Contains(ItemID, NUMBER) && (client.Inventory.Contains(ItemID, NUMBER))
PHP Code:
PS: || can mean OR , && can mean AND
Edit: Super Aids posted 10sec before me , his code may be more useful and practical than mine
|
|
|
02/05/2013, 17:27
|
#4
|
elite*gold: 0
Join Date: Jan 2013
Posts: 24
Received Thanks: 0
|
yeah that looks like what im after, Thanks guys
|
|
|
02/05/2013, 17:48
|
#5
|
elite*gold: 21
Join Date: Jul 2005
Posts: 9,193
Received Thanks: 5,380
|
If you want that sort of a mining system I'd suggest doing a collection of MapID, Points
Implementation would be different in various sources but inside your map class you could do List<Point> or you could have a Dictionary<ushort, List<Point>> where the key is the map id
Then when you receive the mining packet you say...
if(ValidMiningLocations.ContainsKey(user.MapID) && ValidMiningLocations[user.MapID].Contains(user.Location))
allowmining
else
no mining allowed here
This assumes you are using a Point style system for player coords but you can adjust it to suit your source and your needs.
As for your second question, it depends on how your source handles things.
Are you allowing stackable items? Here's an example based on my albetros source.
Code:
public int ItemCountByIDRange(uint startID, uint endID)
{
var Items = from I in this.Inventory.Values where I.StaticID >= startID && I.StaticID <= endID select I;
int count = 0;
foreach (Structures.ItemInfo item in Items)
count += Math.Max(1, (int)item.Amount);
return count;
}
LINQ is very useful
|
|
|
02/05/2013, 18:55
|
#6
|
elite*gold: 0
Join Date: Jan 2013
Posts: 24
Received Thanks: 0
|
The main idea behind the mining one was a kind of fishing system, Using the rod accessory and the swingaxe action, so was going to be using the pier in bi for instance, marking off the coords around there so it would only work there, i guess to expand that to include multiple shore lines maybe the list<point> would work better for so many coordinates....
Only issue im havin so far is to do with the items, created a new item at 562002 next to hoe and pickaxe using the fishin rod and copied texture, mesh.c3 & weapon.c3 across but it dosent seem to want to show on the character when equipped, and the accessory wont work with 562000 pickaxe item range, Would there be a way to break that so the accessory could be equipped with the pick axe? From testin it seems the swingaxe action is locked into the 562000 range also as i cant get it to activate with another item number range?
|
|
|
02/05/2013, 20:48
|
#7
|
elite*gold: 0
Join Date: Jan 2013
Posts: 62
Received Thanks: 8
|
adding a new item requires adding it in DBC files, which is something that you won't love to do.
if you can do that, i'd suggest an ID close to 2 handed weapons
|
|
|
02/05/2013, 21:11
|
#8
|
elite*gold: 0
Join Date: Jan 2013
Posts: 24
Received Thanks: 0
|
Ahhh i see, Ive added lots of new items but nothing that you would equip as yet untill now, I had a quick browse thru the files and saw texture.dds mesh.c3 and weapon.c3 were all linked so did them but guess there is more to it with equipped items, Shall have to have a deeper dive into that side now.
|
|
|
 |
Similar Threads
|
Selling Multiple Items
12/06/2012 - Trading - 0 Replies
SELLING :
path of exile key 7EUR--
LVL 27 LOL USA account with some champions 7EUR -
Path of exile account 7EUR - Firefall key 5EUR
GW1 full package 8EUR
COD 4 Cdkey 6EUR
GW2 account 30EUR
|
[SIZ] WTS Multiple Items **HOT***
05/20/2011 - Dekaron Trading - 3 Replies
Selling 3 accounts (all items included in pictures):
http://img.photobucket.com/albums/v600/ikudosi/se ll/smn.jpg
http://img.photobucket.com/albums/v600/ikudosi/so no.jpghttp://img.photobucket.com/albums/v600/ikudo si/bara.jpg
Selling Multiple Items:...
|
Multiple items???
03/12/2009 - Conquer Online 2 - 3 Replies
Ok well on my server (Leo) iv seen about 3 marketers with multiple items that are identical. Iv seen a guy with about 10 level 30 unique no soc blades a guy with 3 elite 2 soc swords, all of which were the same level, and a girl with two elite+1 no soc bows, what the hecks goin on?
|
[EMU] Obtain Multiple Unique Items.
11/12/2007 - WoW Exploits, Hacks, Tools & Macros - 4 Replies
This only works on some Emu Servers:
Buy the Unique Item from the Vendor.
Put it into an Empty Bag (not your main backpack).
Drag the bag with the item in it onto the vendor's sells window.
Buy another one of the Unique Items.
Buy the Bag back.
You should now have two of the Unique Items.
|
Multiple Items
12/04/2006 - WoW Exploits, Hacks, Tools & Macros - 11 Replies
Hi, basically i found this exploit a while back, say your at a rare vendor and theres only one item in stock e.g recipe
Bascialy, quickly move the item into your inventory, you can then quickly do it 2-3 more times.. So bascially Gratz! you just bought 5 items when you should of only been able to buy 1! Works undectable , this is so obvious so its proably been posted here before, just thought i'd share text2schild.php?smilienummer=1&text=Later :D' border='0' alt='Later :D' />
|
All times are GMT +1. The time now is 11:14.
|
|