rendered paste bodyIndex: src/server/cachemanager.cpp
===================================================================
--- src/server/cachemanager.cpp (Revision 1776)
+++ src/server/cachemanager.cpp (Arbeitskopie)
@@ -1945,6 +1945,21 @@
return factions.Find(&fac);
}
+Faction *CacheManager::GetFactionByName(const char *name)
+{
+ if (name==NULL)
+ return NULL;
+
+ csHash<Faction*, int>::GlobalIterator it (factions_by_id.GetIterator ());
+ while (it.HasNext ())
+ {
+ Faction* faction = it.Next();
+ if (!strcasecmp(faction->name, name))
+ return faction;
+ }
+ return NULL;
+}
+
Faction *CacheManager::GetFaction(int id)
{
return factions_by_id.Get(id,0);
@@ -2289,6 +2304,7 @@
Faction *f = new Faction;
f->id = atoi( result_factions[x]["id"] );
f->name = result_factions[x]["faction_name"];
+ f->description = result_factions[x]["faction_description"];
f->weight = atof( result_factions[x]["faction_weight"] );
// Stored two different ways
factions.Insert(f,TREE_OWNS_DATA);
Index: src/server/progressionmanager.cpp
===================================================================
--- src/server/progressionmanager.cpp (Revision 1776)
+++ src/server/progressionmanager.cpp (Arbeitskopie)
@@ -4747,19 +4747,28 @@
csString skillName = topNode->GetAttributeValue("NAME");
psSkillInfo * info = CacheManager::GetSingleton().GetSkillByName(skillName);
-
+ Faction * faction = CacheManager::GetSingleton().GetFactionByName(skillName);
csString buff;
+ csString description;
+ int cathegory;
if (info)
{
- buff.Format("<DESCRIPTION NAME=\"%s\" DESC=\"%s\" CAT=\"%d\"/>",
- EscpXML(skillName).GetData(), EscpXML(info->description).GetData(),
- info->category);
+ description = EscpXML(info->description).GetData();
+ cathegory = info->category;
}
+ else if (faction)
+ {
+ description = faction->description;
+ cathegory = PSSKILLS_CATEGORY_FACTIONS;
+ }
else
{
- buff.Format("<DESCRIPTION NAME=\"%s\" DESC=\"\" CAT=\"%d\"/>",
- EscpXML(skillName).GetData(), PSSKILLS_CATEGORY_VARIOUS); // if not found, then category unknown
+ description = "";
+ cathegory = PSSKILLS_CATEGORY_VARIOUS;
}
+ buff.Format("<DESCRIPTION NAME=\"%s\" DESC=\"%s\" CAT=\"%d\"/>",
+ EscpXML(skillName).GetData(), description.GetData(),
+ cathegory);
psCharacter* chr = client->GetCharacterData();
psGUISkillMessage newmsg(client->GetClientNum(),
Index: src/server/cachemanager.h
===================================================================
--- src/server/cachemanager.h (Revision 1776)
+++ src/server/cachemanager.h (Arbeitskopie)
@@ -260,6 +260,7 @@
// Factions
Faction * GetFaction(const char *name);
Faction * GetFaction(int id);
+ Faction * GetFactionByName(const char *name);
csHash<Faction*, int> &GetFactionHash() { return factions_by_id; }
// Spells
Index: src/server/database/mysql/factions.sql
===================================================================
--- src/server/database/mysql/factions.sql (Revision 1776)
+++ src/server/database/mysql/factions.sql (Arbeitskopie)
@@ -10,6 +10,7 @@
CREATE TABLE factions (
id int(8) unsigned NOT NULL auto_increment,
faction_name varchar(40) NOT NULL DEFAULT '' ,
+ `faction_description` text,
faction_weight float(6,3) NOT NULL DEFAULT '1.000' ,
PRIMARY KEY (id)
);
@@ -19,7 +20,7 @@
# Dumping data for table 'factions'
#
-INSERT INTO factions VALUES("1","orcs","1.000");
-INSERT INTO factions VALUES("2","merchants","1.000");
-INSERT INTO factions VALUES("3","liberals","2.000");
-INSERT INTO factions VALUES("4","conservatives","2.000");
+INSERT INTO factions VALUES("1","orcs","faction orcs will garantie you are hated by every one except orks","1.000");
+INSERT INTO factions VALUES("2","merchants","faction merchants will offer you a nice deal from time to time","1.000");
+INSERT INTO factions VALUES("3","liberals","faction liberals will make you popular by all those who value freedom and such stuff","2.000");
+INSERT INTO factions VALUES("4","conservatives","faction conservatives are for those who value tradition and steady life style","2.000");
Index: src/server/bulkobjects/psskills.h
===================================================================
--- src/server/bulkobjects/psskills.h (Revision 1776)
+++ src/server/bulkobjects/psskills.h (Arbeitskopie)
@@ -116,7 +116,8 @@
PSSKILLS_CATEGORY_COMBAT,
PSSKILLS_CATEGORY_MAGIC,
PSSKILLS_CATEGORY_JOBS, //Crafting, mining, etc.
- PSSKILLS_CATEGORY_VARIOUS
+ PSSKILLS_CATEGORY_VARIOUS,
+ PSSKILLS_CATEGORY_FACTIONS
};
class psSkillInfo
Index: src/common/rpgrules/factions.h
===================================================================
--- src/common/rpgrules/factions.h (Revision 1776)
+++ src/common/rpgrules/factions.h (Arbeitskopie)
@@ -29,6 +29,7 @@
struct Faction
{
csString name;
+ csString description;
int id;
float weight;
bool operator==(Faction& other) const
Index: src/common/net/messages.h
===================================================================
--- src/common/net/messages.h (Revision 1776)
+++ src/common/net/messages.h (Arbeitskopie)
@@ -43,7 +43,7 @@
// This holds the version number of the network code, remember to increase
// this each time you do an update which breaks compatibility
-#define PS_NETVERSION 0x008B
+#define PS_NETVERSION 0x008C
// Remember to bump the version in pscssetup.h, as well.
// NPC Networking version is separate so we don't have to break compatibility
Index: src/client/gui/pawsskillwindow.h
===================================================================
--- src/client/gui/pawsskillwindow.h (Revision 1776)
+++ src/client/gui/pawsskillwindow.h (Arbeitskopie)
@@ -119,7 +119,7 @@
pawsListBox *factionList;
pawsMultiLineTextBox *combatSkillDescription, *magicSkillDescription, *jobsSkillDescription;
- pawsMultiLineTextBox *variousSkillDescription, *statsSkillDescription;
+ pawsMultiLineTextBox *variousSkillDescription, *statsSkillDescription, *factionsDescription;
pawsProgressBar *hpBar, *manaBar, *pysStaminaBar, *menStaminaBar, *experienceBar;
pawsTextBox *hpFrac, *manaFrac, *pysStaminaFrac, *menStaminaFrac, *experiencePerc;
Index: src/client/gui/pawsskillwindow.cpp
===================================================================
--- src/client/gui/pawsskillwindow.cpp (Revision 1776)
+++ src/client/gui/pawsskillwindow.cpp (Arbeitskopie)
@@ -126,7 +126,8 @@
variousSkillList = (pawsListBox*)FindWidget("VariousSkillList");
variousSkillDescription = (pawsMultiLineTextBox*)FindWidget("VariousDescription");
- factionList = (pawsListBox*)FindWidget("FactionList");
+ factionList = (pawsListBox*)FindWidget("FactionList");
+ factionsDescription = (pawsMultiLineTextBox*)FindWidget("FactionDescription");
hpBar = dynamic_cast <pawsProgressBar*> (FindWidget("HPBar"));
manaBar = dynamic_cast <pawsProgressBar*> (FindWidget("ManaBar"));
@@ -620,6 +621,11 @@
variousSkillDescription->SetText(descStr);
break;
}
+ case 5://Factions
+ {
+ factionsDescription->SetText(descStr);
+ break;
+ }
}
}
@@ -781,6 +787,11 @@
variousSkillDescription->SetText(desc->GetDescription());
break;
}
+ case 5://Factions
+ {
+ factionsDescription->SetText(desc->GetDescription());
+ break;
+ }
}
}
}
Index: data/gui/skillwindow.xml
===================================================================
--- data/gui/skillwindow.xml (Revision 1776)
+++ data/gui/skillwindow.xml (Arbeitskopie)
@@ -312,6 +312,17 @@
</column>
</columns>
</widget>
+
+ <widget name="" factory="pawsTextBox" >
+ <font name="/planeshift/data/ttf/cupandtalon.ttf" r="255" g="255" b="255" size="12" />
+ <frame x="30" y="110" width="180" height="20" border="no"/>
+ <text string="Faction description:" />
+ </widget>
+
+ <widget name="FactionDescription" factory="pawsMultiLineTextBox" >
+ <frame x="28" y="130" width="375" height="80" border="no" />
+ <font name="/planeshift/data/ttf/LiberationSans-Regular.ttf" r="180" g="180" b="180" size="10" />
+ </widget>
</widget>