[Dev] Rhisis Project

I got the penya rate working from the config file, -feels proud- Here's how I did it:
Open up GameServer/drops.cpp, find;
Code:
	int numb = (int)rand_gen.rand(maxPenya - minPenya) + minPenya;
	if (numb > 0)
	{
Change it to:
Code:
	int numb = (int)rand_gen.rand(maxPenya - minPenya) + minPenya;
	if (numb > 0)
	numb = numb * Server::getGlobalPenyaMultiplier();
	{
I do not know if this is efficent, but it works :3
I'm working on to make the mobs drop more than 1 item now.

The drop rate does affect the %chance of getting the item right?
Ex. If you got 1x drop, the item got 10% of being dropped. With 2x drop = 20%?

Hope I helpt someone, cheers :>

Yes i thought about that :P, glad someone saw it wasn't hard to figure out how to add the multiplier, i believe you can have similar results with drop multiplier.
 
But the drops are bugged..
- If drops are decided to be spawned, it spawns a penya bag and the item. (Normal right?)
- But sometimes the monster doesn't drop anything.. (penya bag should ALWAYS spawn!)
- And if you put more items in the drop file, it will only drop the first one (as in not taking all items into array properly)

Thats one thing every private server lacks, if you arent above .. 15 levels or 20 level above the monster, then the monster must always drop penyabag, and an item if the chance is high enough for that..

I would love to help you guys with this, but I'm adding the attack skills to osaFlyFF...
~ Nicco
 
The drops are not bugged for me :o It's just that the position of the dead monster aint always correct. I'm working on the drops, currently my mobs drop more than 1 item. But need to fix some bugs :>

I'll share this when/if I fix it unless the team already fixed it before me ^^

Btw, what's new in revision 18?
 
The drops are not bugged for me :o It's just that the position of the dead monster aint always correct. I'm working on the drops, currently my mobs drop more than 1 item. But need to fix some bugs :>

I'll share this when/if I fix it unless the team already fixed it before me ^^

Btw, what's new in revision 18?

Doubt that, the team has enough bugs on their plate for now :P.

Revision 18: Fixed the Perrin crash. tested with 6 perrins and had a result of 600,000,000 penya in my Inventory. --GK
Perrins are working now i guess.
 
I think I got a fix for the drops now :>
Penya/Drop rate works now.(I hope :o)
Mobs drop more than 1 item, and the max items dropped should work.
Change in drop.cpp:
Code:
	int numb = (int)rand_gen.rand(maxPenya - minPenya) + minPenya;
	if (numb > 0)
	{
To:
Code:
	[COLOR="Blue"]int penyaRate = Server::getGlobalPenyaMultiplier();[/COLOR]
	int numb = (int)rand_gen.rand(maxPenya - minPenya) + minPenya;
	if (numb > 0)
		[COLOR="Blue"]numb = numb * penyaRate;[/COLOR]
	{
For the drops, change:
Code:
	double chance = 0;
	int dropped = 0;
	for (size_t i = 0; i < items.size(); i++)
	{
		chance = rand_gen.rand(100);
		if(chance <= items.at(i)->chance)
		{
			dropped++;
			ItemSpawned *Item2Spawn = new ItemSpawned(items.at(1)->item, player->getId(), true);
			// remove used old slot and add it in the unused slot
			Item2Spawn->getItem()->setAmount(1);
			Item2Spawn->setPos(mob->getPos(false),false);
			Item2Spawn->setWorld(mob->getWorld());
		}
		if(dropped > maxItems)
			break;
	}
To:
Code:
	double chance = 0;
	[COLOR="Blue"]int dropRate = Server::getGlobalDropsMultiplier();[/COLOR]
	int dropped = 0;
	for (size_t i = 0; i < items.size(); i++)
	{
		chance = rand_gen.rand(100);
		[COLOR="Blue"]items.at(i)->chance = items.at(i)->chance * dropRate;[/COLOR]
		if(chance <= items.at(i)->chance)
		{
			ItemSpawned *Item2Spawn = new ItemSpawned(items.at([COLOR="Blue"]i[/COLOR])->item, player->getId(), true);
			// remove used old slot and add it in the unused slot
			Item2Spawn->getItem()->setAmount(1);
			Item2Spawn->setPos(mob->getPos(false),false);
			Item2Spawn->setWorld(mob->getWorld());
			[COLOR="Blue"]dropped++;[/COLOR]
		}
		if(dropped[COLOR="Blue"]+1[/COLOR] > maxItems)
			break;
	}

I hope it did it the right way, and it will help in the development :>
 
@Dumle
Nice to see people working on it and sharing the source :P
I was so happy that the drop code worked that I forgot to think of somethings :P
The drop rate(penya and items), from what I notice receives a penalty according to level difference, that why a level 60 will hardly drop even penya from an aibatt.
Oh, your code is nice but it would be better to multiple at start up, so it wont make the calculation everytime.
 
hey is it me or the gameserver keep crashing barely 5 minutes after running?
[Edit]
Okay, I wasn't really doing anything much... just let it run and before even 5 minutes, crashed! Tried alot of times and same result...
Client used is fame. Poor compilation?
{Edit]
Problems resolved. Thanks.
 
Last edited:
hey is it me or the gameserver keep crashing barely 5 minutes after running?

well what are doing when it crashes?

you must be more descriptive when you post something like that.

EDIT:

BBim something else came to mind about the drops. when there are multiple drops I notice it drops in a circle around where the mob was. so you would need to create a radius algorithm storing all those coordinated in about 10.00 radius. then you can assign them to the coordinates so it looks better and not like a stack of items.
 
Last edited:
EDIT:

BBim something else came to mind about the drops. when there are multiple drops I notice it drops in a circle around where the mob was. so you would need to create a radius algorithm storing all those coordinated in about 10.00 radius. then you can assign them to the coordinates so it looks better and not like a stack of items.

lol I never tested with more then 1 item :P
I will make it but I would like to make the item drop at the correct place, where the mob is, not were. :\
 
ok so i got game server login server to work but i dled the official release and then the binary and both of there char server wont work ._. there are no errors besides this one.

This Apllication has failed to start the apllication configuration is incorrect. reinstalling the application may fix the problem.

ok so i compiled it on my laptop andit runs on there so i tried it here and it doesn't run on here either.
Laptop = Vista 32bit
Desktop = Xp 32bit

any hints?

(P.S Rhisis forums don't wanna load for me atm so ya ._. il repost this on there when i does)
 
ok so i got game server login server to work but i dled the official release and then the binary and both of there char server wont work ._. there are no errors besides this one.

This Apllication has failed to start the apllication configuration is incorrect. reinstalling the application may fix the problem.

ok so i compiled it on my laptop andit runs on there so i tried it here and it doesn't run on here either.
Laptop = Vista 32bit
Desktop = Xp 32bit

any hints?

(P.S Rhisis forums don't wanna load for me atm so ya ._. il repost this on there when i does)

Char server was compiled as debug mode because of a bug if in release mode, so you will need Visual C++ installed to run it :\
 

Visual C++ 2008 Express
You don't need to add anything to this, install and compile, if it doesn't work with linking or anything, its your windows, NOT the project!
Make sure you have .NET and SERVICE PACK!
As far as I've tried with C++, it depends Extremly on wether you have .NET & Service Pack, and it also depends on what version.

I don't recommend trying to make it compile if you have a cracked windows, because sometimes you need the latest service pack and some windows doesn't allow you to just install an exe, has to go trough the windows update.

I have failed to compile C++ projects around a million times, but the only real Fix is to reinstall windows, to one that you can update windows and have everything updated. Then and only then it will compile without any modifications!

~ Nicco
 
just to be on the safe side. reinstall VS C++ 2008 and get the latest .NET framework. 3.5 is what I use. Even though I have 64x Vista, I make sure and compile it as Win32 and not 64. 32 (or x86) is cross platform for both processor styles. 64x is not backwards compatible and will only work for 64x windows XP and Vista.

This is a problem I knew we would run into.
 
Lol, I never really thought about compiling win32 applications when I had x64 windows XP...
I installed XP home which I bought few years agoe just to test Rhisis =P, hahaha...
I reinstall my pc more than I change underwear O_o
 
I think I got the working code for adding items into inventory(picking up drops, buying, !item) and they'll stack.
So I'll share my code with you guys and hope I did something good :)

Open up GameServer/Inventory.cpp and find "bool Inventory::addItem(Player* player, Item* item, int itemId)" function.

Replace the function with this code:
Code:
bool Inventory::addItem(Player* player, Item* item, int itemId)
{

	PlayerInventory* inventory = player->inv;

	if(inventory->getFirstUnunsedSlot()==-1 || inventory->getFirstUnunsedSlot()>42)
	{
		MessagePacket::InformationMessage(player,TID_GAME_LACKSPACE);
		return false;
	}

	//Collect all the item ids in inventory thats not equipped.
	vector<int> item_list;
	vector<int> slot_list;
	vector<int> amount_list;
	for(unsigned int index = 0; index<42; index++)
	{
		if(inventory->getItemBySlot(index)!= NULL)
		{
			item_list.push_back(inventory->getItemBySlot(index)->getItemId());
			slot_list.push_back(index);
			amount_list.push_back(inventory->getItemBySlot(index)->getAmount());
		}
	}
	//Log(MSG_DEBUG,"Size of item_list %d\n",item_list.size());

	// use the list_item to check if the passed item is in the inventory
	int itemAdded = 0;
	if(item_list.size()>0)
	{
		for(unsigned int index = 0; index<item_list.size();index++)
		{
			// If the item is found
			if(item_list.at(index) == itemId)
			{
				ItemBank *itembank = ItemBanks::getItemBankById(item->getItemId());

				if(item->getAmount() > ItemBanks::getItemBankById(item->getItemId())->maxItems)
					item->setAmount(ItemBanks::getItemBankById(item->getItemId())->maxItems);
				else if(item->getAmount() < 0)
				{
						item->setAmount(0);
						itemAdded = 1;
						return false;
				}
				else if(amount_list.at(index) < itembank->maxItems)
				{
				Item* newItem = new Item();
				newItem->setItemId(item->getItemId());
				newItem->setAmount(amount_list.at(index) + item->getAmount());

				inventory->removeItem(inventory->getItemBySlot(slot_list.at(index)));
				inventory->removeUsedSlot(slot_list.at(index));

				int newSlot = slot_list.at(index);

				inventory->addUsedSlot(newSlot);
				newItem->setSlot(newSlot);
				InventoryPacket::addItem(player, newItem, newSlot);
				inventory->addItem(newItem);

				InventoryPacket::updateSlot(player, newItem, newSlot);

				itemAdded = 1;

				break;
				}

				else
					continue;

			}
			
		}
		if(itemAdded == 0)
		{
			int newSlot = inventory->getFirstUnunsedSlot();

			inventory->addUsedSlot(newSlot);
			item->setSlot(newSlot);

			InventoryPacket::addItem(player, item, newSlot);
			inventory->addItem(item);
			InventoryPacket::updateSlot(player, item, newSlot);
			InventoryPacket::updateInventorySlot(player, item, newSlot, false);

			itemAdded = 1;
		}
	}
	else
	{
		int newSlot = inventory->getFirstUnunsedSlot();
		inventory->addUsedSlot(newSlot);
		item->setSlot(newSlot);
		InventoryPacket::addItem(player, item, newSlot);
		inventory->addItem(item);
		InventoryPacket::updateSlot(player, item, newSlot);

		itemAdded = 1;
	}
	item_list.clear();
	amount_list.clear();
	slot_list.clear();
	itemAdded = 0;
	return true;
}

Hope it's working properly for you guys, I've been working on this some days now ^^.

Edit: I'm not sure about the
Code:
else
	continue;
part. I replaced it before I could test it. (Don't really want to test it 2 AM ;3).
I will test it tomorrow :>
 
I think I got the working code for adding items into inventory(picking up drops, buying, !item) and they'll stack.
So I'll share my code with you guys and hope I did something good :)

Open up GameServer/Inventory.cpp and find "bool Inventory::addItem(Player* player, Item* item, int itemId)" function.

Replace the function with this code:
Code:
bool Inventory::addItem(Player* player, Item* item, int itemId)
{

	PlayerInventory* inventory = player->inv;

	if(inventory->getFirstUnunsedSlot()==-1 || inventory->getFirstUnunsedSlot()>42)
	{
		MessagePacket::InformationMessage(player,TID_GAME_LACKSPACE);
		return false;
	}

	//Collect all the item ids in inventory thats not equipped.
	vector<int> item_list;
	vector<int> slot_list;
	vector<int> amount_list;
	for(unsigned int index = 0; index<42; index++)
	{
		if(inventory->getItemBySlot(index)!= NULL)
		{
			item_list.push_back(inventory->getItemBySlot(index)->getItemId());
			slot_list.push_back(index);
			amount_list.push_back(inventory->getItemBySlot(index)->getAmount());
		}
	}
	//Log(MSG_DEBUG,"Size of item_list %d\n",item_list.size());

	// use the list_item to check if the passed item is in the inventory
	int itemAdded = 0;
	if(item_list.size()>0)
	{
		for(unsigned int index = 0; index<item_list.size();index++)
		{
			// If the item is found
			if(item_list.at(index) == itemId)
			{
				ItemBank *itembank = ItemBanks::getItemBankById(item->getItemId());

				if(item->getAmount() > ItemBanks::getItemBankById(item->getItemId())->maxItems)
					item->setAmount(ItemBanks::getItemBankById(item->getItemId())->maxItems);
				else if(item->getAmount() < 0)
				{
						item->setAmount(0);
						itemAdded = 1;
						return false;
				}
				else if(amount_list.at(index) < itembank->maxItems)
				{
				Item* newItem = new Item();
				newItem->setItemId(item->getItemId());
				newItem->setAmount(amount_list.at(index) + item->getAmount());

				inventory->removeItem(inventory->getItemBySlot(slot_list.at(index)));
				inventory->removeUsedSlot(slot_list.at(index));

				int newSlot = slot_list.at(index);

				inventory->addUsedSlot(newSlot);
				newItem->setSlot(newSlot);
				InventoryPacket::addItem(player, newItem, newSlot);
				inventory->addItem(newItem);

				InventoryPacket::updateSlot(player, newItem, newSlot);

				itemAdded = 1;

				break;
				}

				else
					continue;

			}
			
		}
		if(itemAdded == 0)
		{
			int newSlot = inventory->getFirstUnunsedSlot();

			inventory->addUsedSlot(newSlot);
			item->setSlot(newSlot);

			InventoryPacket::addItem(player, item, newSlot);
			inventory->addItem(item);
			InventoryPacket::updateSlot(player, item, newSlot);
			InventoryPacket::updateInventorySlot(player, item, newSlot, false);

			itemAdded = 1;
		}
	}
	else
	{
		int newSlot = inventory->getFirstUnunsedSlot();
		inventory->addUsedSlot(newSlot);
		item->setSlot(newSlot);
		InventoryPacket::addItem(player, item, newSlot);
		inventory->addItem(item);
		InventoryPacket::updateSlot(player, item, newSlot);

		itemAdded = 1;
	}
	item_list.clear();
	amount_list.clear();
	slot_list.clear();
	itemAdded = 0;
	return true;
}

Hope it's working properly for you guys, I've been working on this some days now ^^.

Edit: I'm not sure about the
Code:
else
	continue;
part. I replaced it before I could test it. (Don't really want to test it 2 AM ;3).
I will test it tomorrow :>

very nice, i haven't had the chance to check it out but sharing code helps alot, right now trying to write a scripting system for our npcs, not having much luck :P.
 
Back