Moved faction stuff around, removed stupid external item status stuff

This commit is contained in:
KimLS
2013-02-23 15:03:15 -08:00
parent 5a69f41f4d
commit 147c96970c
19 changed files with 1047 additions and 1161 deletions
+1
View File
@@ -27,6 +27,7 @@ SET(common_sources
EQStreamProxy.cpp
eqtime.cpp
extprofile.cpp
faction.cpp
guild_base.cpp
guilds.cpp
ipc_mutex.cpp
+141
View File
@@ -0,0 +1,141 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
are required to give you total support for your newly bought product;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "debug.h"
#include "faction.h"
#include "races.h"
const char *FactionValueToString(FACTION_VALUE fv) {
switch(fv) {
case FACTION_ALLY:
return("Ally");
case FACTION_WARMLY:
return("Warmly");
case FACTION_KINDLY:
return("Kindly");
case FACTION_AMIABLE:
return("Amiable");
case FACTION_INDIFFERENT:
return("Indifferent");
case FACTION_APPREHENSIVE:
return("Apprehensive");
case FACTION_DUBIOUS:
return("Dubious");
case FACTION_THREATENLY:
return("Threatenly");
case FACTION_SCOWLS:
return("Scowls, ready to attack.");
default:
break;
}
return("Unknown Faction Con");
}
//o--------------------------------------------------------------
//| Name: CalculateFaction; rembrant, Dec. 16, 2001
//o--------------------------------------------------------------
//| Notes: Returns the faction message value.
//| Modify these values to taste.
//o--------------------------------------------------------------
FACTION_VALUE CalculateFaction(FactionMods* fm, int32 tmpCharacter_value)
{
int32 character_value = tmpCharacter_value;
if (fm)
character_value += fm->base + fm->class_mod + fm->race_mod + fm->deity_mod;
if(character_value >= 1101) return FACTION_ALLY;
if(character_value >= 701 && character_value <= 1100) return FACTION_WARMLY;
if(character_value >= 401 && character_value <= 700) return FACTION_KINDLY;
if(character_value >= 101 && character_value <= 400) return FACTION_AMIABLE;
if(character_value >= 0 && character_value <= 100) return FACTION_INDIFFERENT;
if(character_value >= -100 && character_value <= -1) return FACTION_APPREHENSIVE;
if(character_value >= -700 && character_value <= -101) return FACTION_DUBIOUS;
if(character_value >= -999 && character_value <= -701) return FACTION_THREATENLY;
if(character_value <= -1000) return FACTION_SCOWLS;
return FACTION_INDIFFERENT;
}
// neotokyo: this function should check if some races have more than one race define
bool IsOfEqualRace(int r1, int r2)
{
if (r1 == r2)
return true;
// TODO: add more values
switch(r1)
{
case DARK_ELF:
if (r2 == 77)
return true;
break;
case BARBARIAN:
if (r2 == 90)
return true;
}
return false;
}
// neotokyo: trolls endure ogres, dark elves, ...
bool IsOfIndiffRace(int r1, int r2)
{
if (r1 == r2)
return true;
// TODO: add more values
switch(r1)
{
case DARK_ELF:
case OGRE:
case TROLL:
if (r2 == OGRE || r2 == TROLL || r2 == DARK_ELF)
return true;
break;
case HUMAN:
case BARBARIAN:
case HALF_ELF:
case GNOME:
case HALFLING:
case WOOD_ELF:
if (r2 == HUMAN ||
r2 == BARBARIAN ||
r2 == ERUDITE ||
r2 == HALF_ELF ||
r2 == GNOME ||
r2 == HALFLING ||
r2 == DWARF ||
r2 == HIGH_ELF ||
r2 == WOOD_ELF)
return true;
break;
case ERUDITE:
if (r2 == HUMAN || r2 == HALF_ELF)
return true;
break;
case DWARF:
if (r2 == HALFLING || r2 == GNOME)
return true;
break;
case HIGH_ELF:
if (r2 == WOOD_ELF)
return true;
break;
case VAHSHIR:
return true;
case IKSAR:
return false;
}
return false;
}
+2 -2
View File
@@ -54,14 +54,15 @@ struct FactionMods
int32 race_mod;
int32 deity_mod;
};
struct Faction {
int32 id;
std::map<std::string, int16> mods;
int16 base;
char name[50];
};
typedef map<uint32, int16> faction_map;
typedef std::map<uint32, int16> faction_map;
struct NPCFaction
{
uint32 factionID;
@@ -71,6 +72,5 @@ struct NPCFaction
};
const char *FactionValueToString(FACTION_VALUE fv);
char* BuildFactionMessage(int32 tmpvalue, int32 faction_id, int32 totalvalue, uint8 temp);
FACTION_VALUE CalculateFaction(FactionMods* fm, int32 tmpCharacter_value);
#endif
+5
View File
@@ -1884,6 +1884,11 @@ void SharedDatabase::LoadLootDrops(void *data, uint32 size) {
++(ld->NumEntries);
++current_entry;
}
if(current_id != 0) {
hash.insert(current_id, loot_drop, (sizeof(LootDrop_Struct) +
(sizeof(LootDropEntries_Struct) * ld->NumEntries)));
}
mysql_free_result(result);
} else {
LogFile->write(EQEMuLog::Error, "Error getting loot drop info from database: %s, %s", query, errbuf);
-1
View File
@@ -91,7 +91,6 @@ public:
const NPCFactionList* GetNPCFactionEntry(uint32 id);
void LoadNPCFactionLists(void *data, uint32 size, uint32 list_count, uint32 max_lists);
bool LoadNPCFactionLists();
//bool DBLoadNPCFactionLists(int32 iNPCFactionListCount, uint32 iMaxNPCFactionListID);
//loot
void GetLootTableInfo(uint32 &loot_table_count, uint32 &max_loot_table, uint32 &loot_table_entries);