View Single Post
  #5  
Old 02-25-2010, 10:02 AM
bad_captain
Developer
 
Join Date: Feb 2009
Location: Cincinnati, OH
Posts: 512
Default

Quote:
Originally Posted by trevius View Post
Looks like pet classes are going to love you for this

My questions are:
1. In bonuses.cpp, what happens if the pet has multiple haste items? Do the hastes all stack or does it just use the highest value like haste should?

2. I don't know anything about pet focuses, but I assume they could work on charmed pets as well. If so, will your code that adds their loot to them but doesn't care about charges be able to cause any exploits? You can't get items with charges back from normal pet corpses, but you can from charmed ones.
You're right about the haste. You can tell I was a caster!
This fixes that, so it's just like the client bonuses. Only picks the highest one. I also changed the loop so that it checks all slots but ammo, as I guess you don't get stats from ammo slot as mentioned in the client CalcItemBonuses?

Code:
--- bonuses.cpp	(revision 991)
+++ bonuses.cpp	(working copy)
@@ -1126,8 +1126,8 @@
 {
 	if(newbon){
 
-		for(int i = 0; i < 8; i++){
-			const Item_Struct *cur = database.GetItem(equipment[i]);
+		for(int i = 0; i < MAX_INVENTORY_SLOTS-1; i++){
+			const Item_Struct *cur = database.GetItem(equipped_items[i]);
 			if(cur){
 				//basic stats
 				newbon->AC += cur->AC;
@@ -1146,7 +1146,6 @@
 				newbon->CR += cur->CR;
 				newbon->PR += cur->PR;
 				newbon->DR += cur->DR;
-				
 
 				//more complex stats
 				if(cur->Regen > 0) {
@@ -1182,12 +1181,14 @@
 				if(cur->CombatEffects > 0) {
 					newbon->ProcChance += cur->CombatEffects;
 				}
+				if(newbon->haste < (sint8)cur->Haste) {
+					newbon->haste = cur->Haste;
+				}
 				if (cur->Worn.Effect>0 && (cur->Worn.Type == ET_WornEffect)) { // latent 

effects
 					ApplySpellsBonuses(cur->Worn.Effect, cur->Worn.Level, newbon);
 				}
 			}
 		}
-	
 	}
 }
And I'm not sure about your question #2. Do you mean the equipment that automatically is summoned with the pet or just giving equipment to the charmed pet? Unless I'm mistaken, charmed pets will not get any of the pre-summoned equipment, and I don't believe they benefit from any focus effect. Only a summoned pet would gain from it. The focus affects the pet within MakePet, which I don't believe is used when an npc is charmed.

The only code I changed with regards to charmed pets would be that they now have an expanded inventory. The mechanism for giving the pet equipment remains the same, so I assume whatever precautions were taken into account before would still be in effect. I also believe no nodrop items can be given, but on that I'm not certain. Again, it should be just as it was before.

In AddLootDrop, a serverLootItem_Struct named item is created, assigned an id, and # of charges set.
Code:
item->item_id = item2->ID;
	item->charges = charges;
	item->aug1 = 0;
	item->aug2 = 0;
	item->aug3 = 0;
	item->aug4 = 0;
	item->aug5 = 0;
Then that item is pushed into the item list, which should contain the same number of charges.
Code:
if(itemlist != NULL)
		itemlist->push_back(item);
	else
		safe_delete(item);
I don't believe there was a restriction on the number of items a loottable can contain in its itemlist, but only a certain few would have been visible. When an npc is looted, it pulls from the itemlist. With the changes I've made, the only difference should be that besides the visible list of items (which doesn't affect the items available for loot), there is also a list of items that are just there to calculate bonuses and such from. Again, I don't believe this list would in any way affect what items can or can't be looted.

I may be incorrect, but I don't think that would be an issue.
Reply With Quote