Go Back   EQEmulator Home > EQEmulator Forums > Development > Development::Development

Development::Development Forum for development topics and for those interested in EQEMu development. (Not a support forum)

Reply
 
Thread Tools Display Modes
  #1  
Old 10-04-2008, 01:50 AM
AndMetal
Developer
 
Join Date: Mar 2007
Location: Ohio
Posts: 648
Default

That sounds like a good place for me to start

If we can get it moved to a system that iterates through the values, we can always have a default case, just like we do currently in spell_effects.cpp, that doesn't do anything. That way, we can get the AAs in, then focus on the spells effects.

Just thinking out loud, but from what I can see & remember, bonuses for the client are called from Client::CalcBonuses() in zone/bonuses.cpp:
Code:
void Client::CalcBonuses()
{
	_ZP(Client_CalcBonuses);
	memset(&itembonuses, 0, sizeof(StatBonuses));
	CalcItemBonuses(&itembonuses);
	CalcEdibleBonuses(&itembonuses);
	
	RecalcWeight();
	
	CalcSpellBonuses(&spellbonuses);
	
	CalcAC();
	CalcATK();
	CalcHaste();
	
	CalcSTR();
	CalcSTA();
	CalcDEX();
	CalcAGI();
	CalcINT();
	CalcWIS();
	CalcCHA();
	
	CalcMR();
	CalcFR();
	CalcDR();
	CalcPR();
	CalcCR();
	
	CalcMaxHP();
	CalcMaxMana();
	CalcMaxEndurance();
	
	rooted = FindType(SE_Root);
}
so we already have functions for the big stuff. I would think we could then start with a similar function for AAs. I'm sure we could have it piggyback spellbonuses, although it might be better to add aabonuses into the Mob class in zone/mob.h, just in case we want to count it separately (but have to change several places in the source to look at itembonuses + spellbonuses + aabonuses).

I've been working on it, but don't have anything usable yet.

P.S. I moved the discussion since it doesn't really apply to just the Regen AA anymore.
__________________
GM-Impossible of 'A work in progress'
A non-legit PEQ DB server
How to create your own non-legit server

My Contributions to the Wiki
Reply With Quote
  #2  
Old 07-04-2009, 04:41 AM
AndMetal
Developer
 
Join Date: Mar 2007
Location: Ohio
Posts: 648
Default

Wow, I can't believe it's been 9 months... But I finally got this worked out (for the most part), although there's something I'm struggling with.

The way I have it setup currently, we'll load the aa_effects from the database into an array when the zone boots up. However, it's a fairly static array (1628 AA IDs * 7 slots per), which uses more memory that it really needs to (182,336 bytes per zone per my calculations). I don't think it's really necessary to load into Shared Memory (although it wouldn't hurt), but I think we'd be better off using a map instead.

The biggest hurdle is trying to figure out how to nest 1 map inside another (I think VS2008 is trying to make it a tree). I want to be able to access it via aa_effects[aaid][slot] and have it return an AA_Ability struct (or maybe even a new struct that doesn't have the slot).

Could someone with a little more C++ knowledge help point me in the right direction?
__________________
GM-Impossible of 'A work in progress'
A non-legit PEQ DB server
How to create your own non-legit server

My Contributions to the Wiki
Reply With Quote
  #3  
Old 07-06-2009, 01:40 AM
AndMetal
Developer
 
Join Date: Mar 2007
Location: Ohio
Posts: 648
Default

Well, I went ahead and committed this to SVN, but if anyone has a suggestion on how to do this better, let me know. Here's the array:

zone/AA.h
Code:
#define MAX_AA_EFFECT_SLOTS 7
extern AA_Ability aa_effects[aaHighestID][MAX_AA_EFFECT_SLOTS];
zone/AA.cpp
Code:
AA_Ability aa_effects[aaHighestID][MAX_AA_EFFECT_SLOTS];
__________________
GM-Impossible of 'A work in progress'
A non-legit PEQ DB server
How to create your own non-legit server

My Contributions to the Wiki
Reply With Quote
  #4  
Old 07-06-2009, 02:44 AM
KLS
Administrator
 
Join Date: Sep 2006
Posts: 1,348
Default

I wrote up a simple example that should be fairly informative with regards to nesting one map in another. Keep in mind something the >> on the end of the map decl doesn't compile on g++, which is why it's > >, gnu translates it as an operator instead of apart of the declaration. At least last time I tried it this was the case.

Code:
#include <stdio.h>
#include <iostream>
#include <string>
#include <map>

int main()
{
	std::map<int, std::map<int, std::string> > some_double_map;

	std::map<int, std::string> string_map;
	string_map[1] = "Wow";
	string_map[9] = "Bonk";

	std::map<int, std::string> string_map_two;
	string_map_two[3] = "Rich";
	string_map_two[1] = "Test";

	some_double_map[0] = string_map;
	some_double_map[1] = string_map_two;

	std::map<int, std::map<int, std::string> >::iterator iter = some_double_map.find(0);

	if(iter != some_double_map.end())
	{
		std::map<int, std::string>::iterator iter_inner = iter->second.find(1);
		if(iter_inner != iter->second.end())
		{
			printf("Found string %s\n", iter_inner->second.c_str());
		}
		else
		{
			printf("Failed to find string =(\n");
		}
	}
	else
	{
		printf("Failed to find std::map =(\n");
	}

	iter = some_double_map.find(1);
	if(iter != some_double_map.end())
	{
		std::map<int, std::string>::iterator iter_inner = iter->second.find(1);
		if(iter_inner != iter->second.end())
		{
			printf("Found string %s\n", iter_inner->second.c_str());
		}
		else
		{
			printf("Failed to find string =(\n");
		}
	}
	else
	{
		printf("Failed to find std::map =(\n");
	}

	std::cin.get();
	return 0;
}
Reply With Quote
  #5  
Old 07-06-2009, 11:14 PM
gaeorn
Developer
 
Join Date: Apr 2009
Location: USA
Posts: 478
Default

Quote:
Originally Posted by KLS View Post
I wrote up a simple example that should be fairly informative with regards to nesting one map in another. Keep in mind something the >> on the end of the map decl doesn't compile on g++, which is why it's > >, gnu translates it as an operator instead of apart of the declaration. At least last time I tried it this was the case.
That is correct. If you write it as >>, g++ will throw an error. Writing it as > > with a space between them will work find with g++. I'm using g++ 4.3.2, so fairly recent.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 08:17 PM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3