put_shop

matt.chugg

Moderator
how come put_shop() doesn't accept an argument for the quantity of the item to put in the mall ? do I have to closet any I want to keep before I put them in the mall ?

Apologies if I am barking up the wrong tree, or indeed if this tree has already been wrongly barked up.
 

tebee

Member
[quote author=holatuwol link=topic=1621.msg7604#msg7604 date=1205621122]
If I remember right, the reason was to avoid repricing bots.  
[/quote]

Now I know we have somewhat different philosophies, and it's basically your program not mine, but surely all this restriction does is cause more server hits, it's fairly trivial to write a routine to do this -

Code:
// Mall sells all but "leave" of an item

void mall_sell(string item_string, int leave, int price)
{
        item item_item;
	int count;
	int total;
	item_item = to_item(item_string);
	count = item_amount(item_item);
	if (count>leave)
	{
		int difference;
		difference = count-leave;
		total = price*difference;
		mall_meat = mall_meat + total;
		put_closet(leave, item_item);
		print ("Now mall selling " + to_string(difference) +" of " + item_string + " for " + to_string(price) + " for a total of " + to_string(total), "red");
		put_shop(price, 0 , item_item);
		take_closet(leave, item_item);
	}
}

but this has two extra server hits which could be avoided if we could specify the number to be mall sold.


Once again, I must say I don't intend this as criticism of your view of what mafia should be doing, it's just my slightly different take on the way of implementing it - " someone on the internet is wrong"

I really appreciate what you have given us with mafia and all the hard work you put in keeping it up to date and fixing all those bugs us pesky users find - I'm yet another person it's kept playing KOL long after he would have given up without it.

Tom
 

matt.chugg

Moderator
I did it a bit different but pretty much the same, since its a cleanup type of script I did check for item_amount(item) != 0 otherwise it will print for each item not just items it actually does something with

Code:
void mallsell(item itemtosell, int numbertokeep)
{
	if (item_amount(itemtosell) != 0)
	{
		if (numbertokeep = 0)
		{
			print("Mall-Selling " + itemtosell + " (" + item_amount(itemtosell) + ")");
			put_shop(0,0,itemtosell);
		} 
		else 
		{
			if (item_amount(itemtosell) > numbertokeep)
			{
				print("Mall-Selling " + itemtosell + " (" + item_amount(itemtosell) + ") (Keeping " + numbertokeep + ")");
				put_closet(numbertokeep,itemtosell);
				put_shop(0,0,itemtosell);
				take_closet(numbertokeep, itemtosell);
			}
		}
	}
}

void mallsell_stuff()
{

// SNIP!
	mallsell($item[a little sump'm sump'm],0);
	mallsell($item[boxed wine],0);
	mallsell($item[Divine],0);
	mallsell($item[papaya sling],0);
	mallsell($item[papaya slung],0);
	mallsell($item[roll in the hay],0);
// SNIP!
}

I was gonna have mafia undercut but for comse reason the cli undercut command isn't working, it gets the prices successfully but doesn't reprice items. It doesn't work form the GUI either.
Ignore the multitude of typos, I didn't bother previewing and don't seem to have 'edit' privvys
 
Top