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

Archive::Development Archive area for Development's posts that were moved here after an inactivity period of 90 days.

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 05-07-2002, 02:08 AM
kathgar
Discordant
 
Join Date: May 2002
Posts: 434
Default Code

Code:
#include <iostream>
#include <vector>
#include <string>
using namespace std;

struct SPLtemp {
	int spelllevel =0;
	int splid =0;
}


void LoadSPDat() {
	FILE *fp;
	FILE SPlist;
	
	for (int j = 0; j < SPDAT_RECORDS; j++)
		memset((char*) &spells[j], 0, sizeof(SPDat_Spell_Struct));

	if (fp = fopen(SPDat_Location, "rb"))
	{
//		if (_filelength(fp) != SPDAT_SIZE) {
//			cout << "SPDat wrong size ('" << SPDat_Location << "'), spells not loaded." << endl;
//		}
//		else
		{
			for (int i = 0; i < SPDAT_RECORDS; i++) {
				fread(&spells[i], sizeof(SPDat_Spell_Struct), 1, fp);
			}
			for (int x = 0;, x < 15; x++) {
				SPlist.open(strcat(iota(x),".spl"),w);
				SPLtemp tempsing;
				tempsing.level =0; tempsing.splid=0;
				vector<SPLtemp> buckets[7][10];
				
				//LinkedList<LinkedList<SPLtemp>> buckets;
				//LinkedList<SPLtemp> templist;
					
				int spllen =0;
				for (int i = 0; i < SPDAT_RECORDS; i++) {
					if ( spells[i].classes[x] <= 60 ) {
						tempsing.level = spells[i].classes[x]; tempsing.splid = i;
						buckets[((spells[i].classes[x])/10)][(spells[i].classes[x])%10).push_back(tempsing);
						spllen++;
						}											
				}
				
				
				
				/*int swap =0;
				do {
					for (int i = 0; i < spllen - 1; i++) {
						if( templist[i].level > templist[i+1].level) {
							tempsing = templist[i];
							templist[i] = templist[i+1];
							templist[i+1]=tempsing;
							swap = 1;
						}
				}while(swap !=0);*/
				/*for (int i =0; i < spllen; i++) {
					SPlist >> templist[i].level >> ' ' >> templist[i].splid;
				{
				*/
				
				for(int x =0; x < 7; x++)
				{
					for(int y =0; y < 10; y++)
					{
					int count = 0;
					while(count > buckets[x][y].size)
					{
						SPlist >> buckets[x][y][count].level >> ' ' >> buckets[x][y][count].splid;
						count++
					};
				}
				SPlist.close();
			
			{ 
			spells_loaded = true;
			cout << "Spells loaded from '" << SPDat_Location << "'." << endl;
		}
		fclose(fp);
	}
	else
		cout << "SPDat not found ('" << SPDat_Location << "'), spells not loaded." << endl;
}
That should parse the file and create 15 spell lists, in 1.spl = 15.spl with the format
level spellid

Now, client.cpp
Code:
client.cpp

if ((strcasecmp(sep.arg[0], "#scribespells") == 0))
		{
			if (target == 0)  {
				Message(0, "Error: #scribespells: No target");
			}
			else if (sep.arg[1][0] == 0) {
				Message(0, "Usage: #scribespells x");
			}
			else {
				int16 level = atoi(sep.arg[1]);
				if (level > 0 && (level <= 60  {
					FILE sp; sp.open(strcat(atoi(sep.arg[6]),".spl); int templvl = 0;int tempid=0; int y =1;
				sp >> templvl >> tempid;
				while(templvl >= level)
				{

					pp. spell_book[y]=tempid;
					sp >>templvl >>tempid; y++;
				};			
				else {
					Message(0, "Error: #scribespells: Invalid Level");
				}
			}
		}
Reply With Quote
 


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 09:00 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