From: <wel...@us...> - 2009-07-12 19:22:01
|
Revision: 4002 http://planeshift.svn.sourceforge.net/planeshift/?rev=4002&view=rev Author: weltall2 Date: 2009-07-12 19:21:55 +0000 (Sun, 12 Jul 2009) Log Message: ----------- Added support for per character permissions in guilds, Added some missing permissions (among them guild banking permission), made some code shared among various methods, Allowed to define the max guild points attribuible in a guild (there is still a higher maximum but the players can decide their scale), DB BUMP 1225. A note for xordan 4000 was an epic failure!! remember it! Modified Paths: -------------- trunk/data/gui/guildwindow.xml trunk/src/client/cmdguilds.cpp trunk/src/client/gui/pawsguildwindow.cpp trunk/src/client/gui/pawsguildwindow.h trunk/src/common/net/messages.cpp trunk/src/common/net/messages.h trunk/src/common/util/psconst.h trunk/src/server/bankmanager.cpp trunk/src/server/bulkobjects/psguildinfo.cpp trunk/src/server/bulkobjects/psguildinfo.h trunk/src/server/chatmanager.cpp trunk/src/server/database/mysql/characters.sql trunk/src/server/database/mysql/guilds.sql trunk/src/server/database/mysql/server_options.sql trunk/src/server/database/mysql/upgrade_schema.sql trunk/src/server/guildmanager.cpp trunk/src/server/guildmanager.h Modified: trunk/data/gui/guildwindow.xml =================================================================== --- trunk/data/gui/guildwindow.xml 2009-07-12 19:15:12 UTC (rev 4001) +++ trunk/data/gui/guildwindow.xml 2009-07-12 19:21:55 UTC (rev 4002) @@ -203,11 +203,38 @@ <text string="Prv notes" vertAdjust="BOTTOM"/> </widget> + + <widget name="" factory="pawsTextBox" vertical="yes" > + <frame x="384" y="17" width="25" height="130" /> + <font name="/planeshift/data/ttf/LiberationSans-Regular.ttf" r="255" g="255" b="255" size="7" /> + <text string="View al.Chat" vertAdjust="BOTTOM"/> + </widget> + + <widget name="" factory="pawsTextBox" vertical="yes" > + <frame x="407" y="17" width="25" height="130" /> + <font name="/planeshift/data/ttf/LiberationSans-Regular.ttf" r="255" g="255" b="255" size="8" /> + <text string="All. Chat" vertAdjust="BOTTOM"/> + + </widget> + + <widget name="" factory="pawsTextBox" vertical="yes" > + + <frame x="430" y="17" width="25" height="130" /> + <font name="/planeshift/data/ttf/LiberationSans-Regular.ttf" r="255" g="255" b="255" size="8" /> + + <text string="Guild Bank" vertAdjust="BOTTOM"/> + + </widget> + + + + + <widget name="LevelList" factory="pawsListBox" xmlbinding="levellist" id="1100" autoid="yes" selectable="0"> <frame x="25" y="156" width="610" height="195" border="no"/> @@ -298,7 +325,25 @@ <widget name="Edit private" factory="pawsCheckBox"><text string="" position="right"/></widget> </column> + + <column width="23" xmlbinding="alliance_view_chat" > + <widget name="View alliance chat" factory="pawsCheckBox"><text string="" position="right"/></widget> + + </column> + + <column width="23" xmlbinding="alliance_chat" > + + <widget name="Alliance chat" factory="pawsCheckBox"><text string="" position="right"/></widget> + + </column> + + <column width="23" xmlbinding="guild_bank" > + + <widget name="Guild bank" factory="pawsCheckBox"><text string="" position="right"/></widget> + + </column> + </columns> </widget> @@ -422,7 +467,7 @@ <text string="Notify when members login/logout" position="right" /> - </widget> + </widget> <widget name="RemoveMember" factory="pawsButton" id="300"> @@ -473,7 +518,17 @@ <label text="Private notes" /> </widget> + + <widget name="EditMaxGuildPoints" factory="pawsButton" id="311"> + <frame x="510" y="320" width="90" height="19" /> + + <bgimage resource="Standard Button" /> + + <label text="Edit Max GP" /> + + </widget> + </widget> Modified: trunk/src/client/cmdguilds.cpp =================================================================== --- trunk/src/client/cmdguilds.cpp 2009-07-12 19:15:12 UTC (rev 4001) +++ trunk/src/client/cmdguilds.cpp 2009-07-12 19:21:55 UTC (rev 4002) @@ -54,6 +54,8 @@ cmdsource->Subscribe("/guildremove",this); // remove player from guild cmdsource->Subscribe("/guildlevel",this); // name guild level something (ranks) cmdsource->Subscribe("/guildpromote",this); // promote player in guild to level # + cmdsource->Subscribe("/getmemberpermissions",this); // pgets the permissions of a particular player + cmdsource->Subscribe("/setmemberpermissions",this); // sets the permissions of a particular player cmdsource->Subscribe("/guildmembers",this); // see list of members (optional level #) cmdsource->Subscribe("/guildpoints",this); // view "karma points" of named guild cmdsource->Subscribe("/guildname",this); // view "karma points" of named guild @@ -80,6 +82,8 @@ cmdsource->Unsubscribe("/guildremove",this); cmdsource->Unsubscribe("/guildlevel",this); cmdsource->Unsubscribe("/guildpromote",this); + cmdsource->Unsubscribe("/getmemberpermissions",this); + cmdsource->Unsubscribe("/setmemberpermissions",this); cmdsource->Unsubscribe("/guildmembers",this); cmdsource->Unsubscribe("/guildpoints",this); cmdsource->Unsubscribe("/guildname", this); Modified: trunk/src/client/gui/pawsguildwindow.cpp =================================================================== --- trunk/src/client/gui/pawsguildwindow.cpp 2009-07-12 19:15:12 UTC (rev 4001) +++ trunk/src/client/gui/pawsguildwindow.cpp 2009-07-12 19:21:55 UTC (rev 4002) @@ -66,6 +66,7 @@ #define EDIT_PRIVATE_NOTES_BUTTON 304 #define INVITE_BUTTON 305 #define LEAVE_BUTTON 306 +#define EDIT_GUILD_MAX_POINTS_BUTTON 311 #define REMOVE_GUILD 500 #define SET_ALLIANCE_LEADER 501 @@ -340,6 +341,7 @@ guildName->SetText(guildNode->GetAttributeValue("name")); guildSecret->SetState(strcmp(guildNode->GetAttributeValue("secret"),"yes")==0); guildWebPage->SetText(guildNode->GetAttributeValue("web_page")); + max_guild_points = guildNode->GetAttributeValueAsInt("max_points"); } else Error1("No <guild> tag in Open List"); @@ -428,6 +430,12 @@ member.level = memberNode->GetAttributeValueAsInt("level"); chatWindow->AddAutoCompleteName( memberNode->GetAttributeValue("name") ); + //we crop the points client side less strain on the server and less complexity of code + //this way if someone makes a wrong change they can recover the points + + if(member.points > max_guild_points) + member.points = max_guild_points; + members.Push(member); } } @@ -819,11 +827,18 @@ { member = FindSelectedMemberInfo(); if (member != NULL) - pawsNumberPromptWindow::Create("Enter points", member->points, 0, 100, + pawsNumberPromptWindow::Create("Enter points", member->points, 0, max_guild_points, this, "GuildPoints",member->char_id); retVal = true; break; } + case EDIT_GUILD_MAX_POINTS_BUTTON: + { + pawsNumberPromptWindow::Create("Enter Maximum points", max_guild_points, 0, MAX_GUILD_POINTS_LIMIT, + this, "MaxGuildPoints"); + retVal = true; + break; + } case EDIT_PUBLIC_NOTES_BUTTON: { member = FindSelectedMemberInfo(); @@ -1133,16 +1148,23 @@ void pawsGuildWindow::OnNumberEntered(const char *name,int param,int value) { + if (value == -1) + return; + if (!strcmp(name,"GuildPoints")) { - if (value == -1) - return; - csString command; command.Format("<p char_id=\"%i\" points=\"%i\"/>", param, value); psGUIGuildMessage msg(psGUIGuildMessage::SET_MEMBER_POINTS, command); msg.SendMessage(); } + else if (!strcmp(name,"MaxGuildPoints")) + { + csString command; + command.Format("<mp max_guild_points=\"%i\"/>", value); + psGUIGuildMessage msg(psGUIGuildMessage::SET_MAX_GUILD_POINTS, command); + msg.SendMessage(); + } } void pawsGuildWindow::OnItemChosen(const char *name,int param,int itemNum, const csString & itemText) Modified: trunk/src/client/gui/pawsguildwindow.h =================================================================== --- trunk/src/client/gui/pawsguildwindow.h 2009-07-12 19:15:12 UTC (rev 4001) +++ trunk/src/client/gui/pawsguildwindow.h 2009-07-12 19:21:55 UTC (rev 4002) @@ -127,9 +127,11 @@ csArray<guildMemberInfo> members; - int char_id; // character_id of our player - int playerLevel; // guild level of our player + int char_id; ///< character_id of our player + int playerLevel; ///< guild level of our player + int max_guild_points; ///< keeps the max amount of guild points allowed in this guild + /** Stores names of guild levels. Number of the level is equal to the index in array so the 0. array member * is empty and should be ignored. */ Modified: trunk/src/common/net/messages.cpp =================================================================== --- trunk/src/common/net/messages.cpp 2009-07-12 19:15:12 UTC (rev 4001) +++ trunk/src/common/net/messages.cpp 2009-07-12 19:21:55 UTC (rev 4002) @@ -1043,11 +1043,17 @@ guildname = words.GetTail(1); return; } - if (command == "/guildinvite" || command == "/guildremove" || command == "/allianceinvite") + if (command == "/guildinvite" || command == "/guildremove" || command == "/allianceinvite" || command == "/getmemberpermissions") { player = words[1]; return; } + if (command == "/setmemberpermissions") + { + player = words[1]; + subCmd = words[2]; + permission = words[3]; + } if (command == "/guildlevel") { level = words.GetInt(1); Modified: trunk/src/common/net/messages.h =================================================================== --- trunk/src/common/net/messages.h 2009-07-12 19:15:12 UTC (rev 4001) +++ trunk/src/common/net/messages.h 2009-07-12 19:21:55 UTC (rev 4002) @@ -1072,7 +1072,7 @@ class psGuildCmdMessage : public psMessageCracker { public: - csString command, guildname, player, levelname, accept, secret, web_page,motd, alliancename; + csString command, subCmd, permission, guildname, player, levelname, accept, secret, web_page,motd, alliancename; int level; @@ -1119,7 +1119,8 @@ SET_LEVEL_RIGHT, ///< Clients changes right for guild level - SET_MEMBER_POINTS, + SET_MEMBER_POINTS, ///< Sets the amount of guild points assigned to a member + SET_MAX_GUILD_POINTS, ///< Sets the maximum amount of guild points for the guild SET_MEMBER_PUBLIC_NOTES, SET_MEMBER_PRIVATE_NOTES, Modified: trunk/src/common/util/psconst.h =================================================================== --- trunk/src/common/util/psconst.h 2009-07-12 19:15:12 UTC (rev 4001) +++ trunk/src/common/util/psconst.h 2009-07-12 19:21:55 UTC (rev 4002) @@ -106,6 +106,8 @@ #define GUILD_KICK_GRACE 5 ///< minutes #define MAX_GUILD_LEVEL 9 +#define DEFAULT_MAX_GUILD_POINTS 100 +#define MAX_GUILD_POINTS_LIMIT 9999 //@} #define SIZET_NOT_FOUND ((size_t)-1) Modified: trunk/src/server/bankmanager.cpp =================================================================== --- trunk/src/server/bankmanager.cpp 2009-07-12 19:15:12 UTC (rev 4001) +++ trunk/src/server/bankmanager.cpp 2009-07-12 19:21:55 UTC (rev 4002) @@ -626,8 +626,8 @@ return; } - // Not leader (will change later on to have flexible permissions). - if(guild && pschar->GetGuildLevel()->level != 9) + // Check if the player has the permission to use the bank account of his guild. + if(guild && !pschar->GetGuildMembership()->HasRights(RIGHTS_USE_BANK)) { psserver->SendSystemError(client->GetClientNum(), "You cannot access your guild bank account without being the leader of your guild!"); return; @@ -705,8 +705,8 @@ return; } - // Not leader (will change later on to have flexible permissions). - if(msg.guild && client->GetCharacterData()->GetGuildLevel()->level != 9) + // Check if the player has the permission to use the bank account of his guild. + if(msg.guild && client->GetCharacterData()->GetGuildMembership()->HasRights(RIGHTS_USE_BANK)) { psserver->SendSystemError(client->GetClientNum(), "You cannot access your guild bank account without being the leader of your guild!"); return; Modified: trunk/src/server/bulkobjects/psguildinfo.cpp =================================================================== --- trunk/src/server/bulkobjects/psguildinfo.cpp 2009-07-12 19:15:12 UTC (rev 4001) +++ trunk/src/server/bulkobjects/psguildinfo.cpp 2009-07-12 19:21:55 UTC (rev 4002) @@ -95,6 +95,8 @@ if (row["secret_ind"]) secret = (*row["secret_ind"]=='Y'); + + max_guild_points = row.GetInt("max_guild_points"); // Now get levels Result result(db->Select("select * from guildlevels where guild_id=%d order by level",id)); @@ -114,7 +116,7 @@ } // Now preload members - Result member(db->Select("select id,name,guild_level,guild_points,guild_public_notes,guild_private_notes, last_login" + Result member(db->Select("select id,name,guild_level,guild_points,guild_public_notes,guild_private_notes, last_login, guild_additional_privileges, guild_denied_privileges" " from characters" " where guild_member_of=%d",id)); @@ -135,10 +137,12 @@ gm->actor = NULL; gm->guildlevel = FindLevel(member[i].GetInt("guild_level")); - gm->guild_points = member[i].GetInt("guild_points"); - gm->public_notes = member[i]["guild_public_notes"]; - gm->private_notes = member[i]["guild_private_notes"]; - gm->last_login = member[i]["last_login"]; + gm->guild_points = member[i].GetInt("guild_points"); + gm->public_notes = member[i]["guild_public_notes"]; + gm->private_notes = member[i]["guild_private_notes"]; + gm->last_login = member[i]["last_login"]; + gm->privileges = member[i].GetInt("guild_additional_privileges"); + gm->removedPrivileges = member[i].GetInt("guild_denied_privileges"); if (!gm->guildlevel) { @@ -171,9 +175,12 @@ db->Escape(guildEsc,this->name); - if (db->Command("insert into guilds (name,char_id_founder,date_created) " - "values ('%s', %d, Now() )", - guildEsc.GetData(), leader_char_id.Unbox()) != 1) + if (db->Command("insert into guilds (name,char_id_founder,date_created,max_guild_points) " + "values ('%s', %d, Now(), %d )", + guildEsc.GetData(), + leader_char_id.Unbox(), + DEFAULT_MAX_GUILD_POINTS) + != 1) { Error3 ("Couldn't create new guild.\nCommand was " "<%s>.\nError returned was <%s>\n",db->GetLastQuery(),db->GetLastError()); @@ -308,6 +315,8 @@ gm->guild_points = 0; gm->guildlevel = FindLevel(level); gm->name = player->name; + gm->privileges = 0; + gm->removedPrivileges = 0; members.Push(gm); @@ -487,8 +496,67 @@ return false; } +bool psGuildInfo::SetMemberPrivilege(psGuildMember *member, GUILD_PRIVILEGE privilege, bool on) +{ + psGuildLevel *lev = member->guildlevel; + if (lev) + { + if (on) + { + if(!member->HasRights(privilege)) //we operate only if the character doesn't have the privilege + { + if(lev->HasRights(privilege)) //should the character have the right because of his level? + { + //if so remove this privilege among the specially denied privileges + member->removedPrivileges &= ~privilege; + } + else //we are adding it as a special privilege for the character + { + member->privileges |= privilege; + } + } + else + { + return false; //nothing to do here + } + } + else + { + if(member->HasRights(privilege)) //we operate only if the character has the privilege + { + if(lev->HasRights(privilege)) //does the character have the right because of his level? + { + //if so add this privilege among the specially denied privileges + member->removedPrivileges |= privilege; + } + else //it was a special privilege the character had, so just remove it + { + member->privileges &= ~privilege; + } + } + else + { + return false; //nothing to do the character doesn't have the privilege + } + } + unsigned long res = db->Command("update characters" + " set guild_additional_privileges='%d' guild_denied_privileges='%d'" + " where id = '%d'", + member->privileges, member->removedPrivileges, member->char_id.Unbox()); + + if (res == QUERY_FAILED) + { + Error2("sql error: %s", db->GetLastError()); + return false; + } + return true; + } + else + return false; +} + bool psGuildInfo::UpdateMemberLevel(psGuildMember *target,int level) { psGuildLevel *lev = FindLevel(level); @@ -534,6 +602,9 @@ bool psGuildInfo::SetMemberPoints(psGuildMember * member, int points) { + if (points > max_guild_points) + return false; + member->guild_points = points; unsigned long res = db->Command("UPDATE characters SET guild_points=%d WHERE id=%u", points, member->char_id.Unbox()); @@ -545,6 +616,22 @@ return true; } +bool psGuildInfo::SetMaxMemberPoints(int points) +{ + if (points > MAX_GUILD_POINTS_LIMIT) + points = MAX_GUILD_POINTS_LIMIT; + + max_guild_points = points; + + unsigned long res = db->Command("UPDATE guilds SET max_guild_points=%d WHERE id=%u", points, id); + if (res != 1) + { + Error3("Couldn't save max guild_points of %d: %s", id, db->GetLastError()); + return false; + } + return true; +} + bool psGuildInfo::SetMemberNotes(psGuildMember * member, const csString & notes, bool isPublic) { const char * dbName; Modified: trunk/src/server/bulkobjects/psguildinfo.h =================================================================== --- trunk/src/server/bulkobjects/psguildinfo.h 2009-07-12 19:15:12 UTC (rev 4001) +++ trunk/src/server/bulkobjects/psguildinfo.h 2009-07-12 19:21:55 UTC (rev 4002) @@ -47,32 +47,39 @@ enum GUILD_PRIVILEGE { - RIGHTS_VIEW_CHAT = 1, // User can view guild chat (command /guild) + RIGHTS_VIEW_CHAT = 1, // User can view guild chat (command /guild) - RIGHTS_CHAT = 2, // User can send guild chat messages (command /guild) + RIGHTS_CHAT = 2, // User can send guild chat messages (command /guild) - RIGHTS_INVITE = 4, // User can invite players to guild + RIGHTS_INVITE = 4, // User can invite players to guild - RIGHTS_REMOVE = 8, // User can remove player of lower level from guild + RIGHTS_REMOVE = 8, // User can remove player of lower level from guild - RIGHTS_PROMOTE = 16, // User can promote/demote players of lower level to another lower level - // User at level 9 (leader) can promote other player to level 9, - // which in turn demotes the leader to level 8. - // Leader cannot just demote himself. - // Leader cannot leave guild. - // This means that each guild has _just_ one level 9 person. + RIGHTS_PROMOTE = 16, // User can promote/demote players of lower level to another lower level + // User at level 9 (leader) can promote other player to level 9, + // which in turn demotes the leader to level 8. + // Leader cannot just demote himself. + // Leader cannot leave guild. + // This means that each guild has _just_ one level 9 person. - RIGHTS_EDIT_LEVEL = 32, // User can change privileges of lower guild levels + RIGHTS_EDIT_LEVEL = 32, // User can change privileges of lower guild levels - RIGHTS_EDIT_POINTS = 64, // User can change guild points of players of lower level + RIGHTS_EDIT_POINTS = 64, // User can change guild points of players of lower level - RIGHTS_EDIT_GUILD = 128, // User can change guild name, guild secrecy, guild web page, can disband guild + RIGHTS_EDIT_GUILD = 128, // User can change guild name, guild secrecy, guild web page, can disband guild, + // max guild points - RIGHTS_EDIT_PUBLIC = 256, // User can edit public notes of player of lower level, - // but the notes are visible to all guild members + RIGHTS_EDIT_PUBLIC = 256, // User can edit public notes of player of lower level, + // but the notes are visible to all guild members - RIGHTS_EDIT_PRIVATE = 512 // User can view and edit private notes of player of lower level, - // others can neither view nor edit them + RIGHTS_EDIT_PRIVATE = 512, // User can view and edit private notes of player of lower level, + // others can neither view nor edit them + + RIGHTS_VIEW_CHAT_ALLIANCE = 1024, // User can view alliance chat (command /alliance /a) + + RIGHTS_CHAT_ALLIANCE = 2048, // User can send alliace chat messages (command /alliace /a) + + RIGHTS_USE_BANK = 4096 // User can use guild bank }; /** Defines a level inside a guild. @@ -103,6 +110,11 @@ csString public_notes; ///< The public notes the member has. csString private_notes; ///< Private Guild notes for the player. csString last_login; ///< The last login time for that user. + int privileges; ///< Bit field for additional privileges. + int removedPrivileges; ///< Bit field for privileges removed from this member. + + bool HasRights(GUILD_PRIVILEGE rights) + { return (guildlevel->HasRights(rights) && !(removedPrivileges & rights) || (privileges & rights)); } }; //------------------------------------------------------------------------------ @@ -125,6 +137,7 @@ private: psMoney bankMoney; ///< Money stored in the guild bank account. + int max_guild_points; ///< Maximum guild points obtainable in the guild. public: int alliance; @@ -157,6 +170,7 @@ bool RenameLevel(int level, const char *levelname); bool SetPrivilege(int level, GUILD_PRIVILEGE privilege, bool on); + bool SetMemberPrivilege(psGuildMember *member, GUILD_PRIVILEGE privilege, bool on); bool UpdateMemberLevel(psGuildMember *target,int level); void AdjustMoney(psMoney money, bool); @@ -165,6 +179,9 @@ csString& GetName(){ return name; } + bool SetMaxMemberPoints(int points); + int GetMaxMemberPoints() { return max_guild_points; } + bool SetMemberPoints(psGuildMember * member, int points); bool SetMemberNotes(psGuildMember * member, const csString & notes, bool isPublic); Modified: trunk/src/server/chatmanager.cpp =================================================================== --- trunk/src/server/chatmanager.cpp 2009-07-12 19:15:12 UTC (rev 4001) +++ trunk/src/server/chatmanager.cpp 2009-07-12 19:21:55 UTC (rev 4002) @@ -460,7 +460,7 @@ void ChatManager::SendGuild(Client *client, psChatMessage& msg) { psGuildInfo * guild; - psGuildLevel * level; + psGuildMember * member; guild = client->GetCharacterData()->GetGuild(); if (guild == NULL) @@ -469,8 +469,8 @@ return; } - level = client->GetCharacterData()->GetGuildLevel(); - if (level && !level->HasRights(RIGHTS_CHAT)) + member = client->GetCharacterData()->GetGuildMembership(); + if (member && !member->HasRights(RIGHTS_CHAT)) { psserver->SendSystemInfo(client->GetClientNum(), "You are not allowed to use your guild's chat channel."); return; @@ -482,15 +482,15 @@ void ChatManager::SendGuild(const csString & sender, EID senderEID, psGuildInfo * guild, psChatMessage& msg) { ClientIterator iter(*psserver->GetConnections()); - psGuildLevel * level; + psGuildMember * member; while(iter.HasNext()) { Client *client = iter.Next(); if (!client->IsReady()) continue; if (client->GetGuildID() != guild->id) continue; - level = client->GetCharacterData()->GetGuildLevel(); - if ( (!level) || (!level->HasRights(RIGHTS_VIEW_CHAT)) ) continue; + member = client->GetCharacterData()->GetGuildMembership(); + if ( (!member) || (!member->HasRights(RIGHTS_VIEW_CHAT)) ) continue; // Send the chat message psChatMessage newMsg(client->GetClientNum(), senderEID, sender, 0, msg.sText, msg.iChatType, msg.translate); newMsg.SendMessage(); @@ -502,7 +502,7 @@ void ChatManager::SendAlliance(Client *client, psChatMessage& msg) { psGuildInfo * guild; - psGuildLevel * level; + psGuildMember * member; guild = client->GetCharacterData()->GetGuild(); if (guild == NULL) @@ -511,10 +511,10 @@ return; } - level = client->GetCharacterData()->GetGuildLevel(); - if (level && !level->HasRights(RIGHTS_CHAT)) + member = client->GetCharacterData()->GetGuildMembership(); + if (member && !member->HasRights(RIGHTS_CHAT_ALLIANCE)) { - psserver->SendSystemInfo(client->GetClientNum(), "You are not allowed to use your guild's chat channel."); + psserver->SendSystemInfo(client->GetClientNum(), "You are not allowed to use your alliance's chat channel."); return; } @@ -531,15 +531,15 @@ void ChatManager::SendAlliance(const csString & sender, EID senderEID, psGuildAlliance * alliance, psChatMessage& msg) { ClientIterator iter(*psserver->GetConnections()); - psGuildLevel * level; + psGuildMember * member; while(iter.HasNext()) { Client *client = iter.Next(); if (!client->IsReady()) continue; if (client->GetAllianceID() != alliance->GetID()) continue; - level = client->GetCharacterData()->GetGuildLevel(); - if ( (!level) || (!level->HasRights(RIGHTS_VIEW_CHAT)) ) continue; + member = client->GetCharacterData()->GetGuildMembership(); + if ( (!member) || (!member->HasRights(RIGHTS_VIEW_CHAT_ALLIANCE)) ) continue; // Send the chat message psChatMessage newMsg(client->GetClientNum(), senderEID, sender, 0, msg.sText, msg.iChatType, msg.translate); newMsg.SendMessage(); Modified: trunk/src/server/database/mysql/characters.sql =================================================================== --- trunk/src/server/database/mysql/characters.sql 2009-07-12 19:15:12 UTC (rev 4001) +++ trunk/src/server/database/mysql/characters.sql 2009-07-12 19:21:55 UTC (rev 4002) @@ -53,6 +53,8 @@ `loc_yrot` float(10,2) NOT NULL default '0.00', `guild_member_of` int(10) unsigned NOT NULL default '0', `guild_level` tinyint(1) unsigned NOT NULL default '0', + `guild_additional_privileges` smallint(3) unsigned NOT NULL DEFAULT '0' COMMENT 'Contains a bitfield with the additional priviledges assigned to this char (additional to the guild level it''s in)', + `guild_denied_privileges` smallint(3) unsigned NOT NULL DEFAULT '0' COMMENT 'Contains a bitfield with the removed priviledges from this char (removed from the guild level it''s in)', `guild_points` int(10) unsigned NOT NULL default '0', `guild_public_notes` varchar(255) default NULL, `guild_private_notes` varchar(255) default '0', @@ -87,44 +89,44 @@ # Dumping data for table characters # -INSERT INTO `characters` VALUES (1,'Guest','Char','',0,0,144.00,40.00,44.00,40.00,40.00,40.00,0.00,100.00,0.00,100.00,216.00,200.00,34,40,10,134,100,100,100,100,0,3,-43.86,-0.01,-152.30,1.50,0,0,0,NULL,NULL,0,'0000-00-00 00:00:00','1,-50,2,50','',0,0,'N',3,2604,0,180,18,'Was born in a jar','','','',10,'',0,'0000-00-00 00:00:00',0,0); -INSERT INTO `characters` VALUES (2,'Vengeance','IsMine','',0,0,300.00,60.00,60.00,60.00,60.00,60.00,0.00,280.00,0.00,120.00,200.00,200.00,34,40,10,134,0,0,0,0,0,3,-32.03,0.00,-154.36,0.49,0,0,0,NULL,NULL,0,'2006-11-29 21:55:15','1,-40,2,50','',0,0,'N',1,14985,0,150,10,'Grew up on a ice mountain','','','',10,'<category attribute=\"Lifecycle\" name=\"Daylight\" value=\"10\" /><category attribute=\"Type\" name=\"Animal\" value=\"5\" />',3,'0000-00-00 00:00:00',0,0); -INSERT INTO `characters` VALUES (3,'Acraig','Newfie','',2,0,144.00,40.00,44.00,40.00,40.00,40.00,0.00,100.00,0.00,100.00,216.00,200.00,34,40,10,134,100,100,100,100,0,3,-61.32,-0.01,-187.16,0.00,0,0,0,NULL,NULL,0,'0000-00-00 00:00:00','1,-30,2,30','',0,0,'N',5,3798,0,150,1000,'description','','','',1000,'',0,'0000-00-00 00:00:00',0,0); -INSERT INTO `characters` VALUES (4,'MaleEnki','','',1,1,44.00,40.00,44.00,40.00,40.00,40.00,50.00,100.00,100.00,100.00,100.00,100.00,100,100,100,100,100,100,100,100,0,3,-1.00,0.00,-179.00,0.00,0,0,0,'','',0,NULL,'1,30,2,-30','',1,4,'N',9,0,0,0,0,'description','','','',10,'',0,'0000-00-00 00:00:00',0,0); -INSERT INTO `characters` VALUES (5,'Smith','','',7,1,44.00,40.00,44.00,40.00,40.00,40.00,50.00,100.00,100.00,100.00,100.00,100.00,100,100,100,100,100,100,100,100,0,3,-53.54,0.00,-155.11,0.00,0,0,0,'','',0,NULL,'','',1,5,'N',9,0,0,0,0,'description','','','',10,'',0,'0000-00-00 00:00:00',0,0); -INSERT INTO `characters` VALUES (6,'Fighter1','','',2,1,65.00,65.00,65.00,60.00,60.00,60.00,50.00,100.00,100.00,100.00,100.00,100.00,100,100,100,100,100,100,100,100,0,3,-2.00,0.00,-181.00,0.00,0,0,0,'','',0,NULL,'1,30,2,-30','',1,6,'N',9,0,2,0,0,'description','','','',10,'',0,'0000-00-00 00:00:00',0,0); -INSERT INTO `characters` VALUES (7,'Fighter2','','',3,1,100.00,100.00,100.00,100.00,100.00,100.00,200.00,200.00,100.00,100.00,100.00,100.00,100,100,100,100,100,100,100,100,0,3,-92.00,0.00,-266.00,0.00,0,0,0,'','',0,NULL,'1,35,2,-35','',1,6,'N',9,0,2,0,0,'description','','','',10,'',0,'0000-00-00 00:00:00',0,0); -INSERT INTO `characters` VALUES (8,'Merchant','','',7,1,44.00,40.00,44.00,40.00,40.00,40.00,50.00,100.00,100.00,100.00,100.00,100.00,100,100,100,100,100,100,100,100,0,3,-46.54,0.00,-151.11,0.00,0,0,0,'','',0,NULL,'1,30,3,30,4,-50','',1,8,'N',9,0,0,0,0,'description','','','',500,'',0,'0000-00-00 00:00:00', 1,0); -INSERT INTO `characters` VALUES (9,'Lady','Aren','',14,0,44.00,40.00,44.00,40.00,40.00,40.00,0.00,100.00,0.00,100.00,216.00,200.00,34,40,10,134,100,100,100,100,0,3,-43.86,-0.01,-152.30,1.50,0,0,0,NULL,NULL,0,'0000-00-00 00:00:00','1,-50,2,50','',0,0,'N',1,2604,0,180,18,'The love of Guest Char.','','','',10,'',0,'0000-00-00 00:00:00',0,0); -INSERT INTO `characters` VALUES (12,'QuestMaster1','','',7,1,44.00,40.00,44.00,40.00,40.00,40.00,50.00,100.00,100.00,100.00,100.00,100.00,100,100,100,100,100,100,100,100,0,3,-30.00,0.00,-150.00,0.00,0,0,0,'','',0,NULL,'1,30,3,30,4,-50','',1,12,'Y',9,0,0,0,0,'Used for quest testing. Type \"step1\" to start Test.','','','',500,'',0,'0000-00-00 00:00:00',0,0); -INSERT INTO `characters` VALUES (13,'QuestMaster2','','',7,1,44.00,40.00,44.00,40.00,40.00,40.00,50.00,100.00,100.00,100.00,100.00,100.00,100,100,100,100,100,100,100,100,0,3,-35.00,0.00,-150.00,0.00,0,0,0,'','',0,NULL,'1,30,3,30,4,-50','',1,13,'Y',9,0,0,0,0,'Used for quest testing. Type \"step1\" to start Test.','','','',500,'',0,'0000-00-00 00:00:00',0,0); -INSERT INTO `characters` VALUES (14,'DictMaster1','','',7,1,44.00,40.00,44.00,40.00,40.00,40.00,50.00,100.00,100.00,100.00,100.00,100.00,100,100,100,100,100,100,100,100,0,3,-40.00,0.00,-150.00,0.00,0,0,0,'','',0,NULL,'1,30,3,30,4,-50','',1,14,'N',9,0,0,0,0,'Used for quest testing. Type \"step1\" to start Test.','','','',500,'',0,'0000-00-00 00:00:00',0,0); -INSERT INTO `characters` VALUES (15,'DictMaster2','','',7,1,44.00,40.00,44.00,40.00,40.00,40.00,50.00,100.00,100.00,100.00,100.00,100.00,100,100,100,100,100,100,100,100,0,3,-45.00,0.00,-150.00,0.00,0,0,0,'','',0,NULL,'1,30,3,30,4,-50','',1,15,'N',9,0,0,0,0,'Used for quest testing. Type \"step1\" to start Test.','','','',500,'',0,'0000-00-00 00:00:00',0,0); -INSERT INTO `characters` VALUES (20,'TribeMember','','',7,1,44.00,40.00,44.00,40.00,40.00,40.00,50.00,100.00,100.00,100.00,100.00,100.00,100,100,100,100,100,100,100,100,0,3,-45.00,0.00,-150.00,0.00,0,0,0,'','',0,NULL,'1,30,3,30,4,-50','',0,20,'N',9,0,0,0,0,'Tribe member. Used in tribe testing.','','','',500,'',0,'0000-00-00 00:00:00',0,0); -INSERT INTO `characters` VALUES (21,'MoveMaster1','','',7,1,44.00,40.00,44.00,40.00,40.00,40.00,50.00,100.00,100.00,100.00,100.00,100.00,100,100,100,100,100,100,100,100,0,3,-30.00,0.00,-130.00,0.00,0,0,0,'','',0,NULL,'1,30,3,30,4,-50','',1,21,'N',9,0,0,0,0,'Used to test movement.','','','',500,'',0,'0000-00-00 00:00:00',0,0); -INSERT INTO `characters` VALUES (22,'MoveMaster2','','',7,1,44.00,40.00,44.00,40.00,40.00,40.00,50.00,100.00,100.00,100.00,100.00,100.00,100,100,100,100,100,100,100,100,0,3,-35.00,0.00,-130.00,0.00,0,0,0,'','',0,NULL,'1,30,3,30,4,-50','',1,22,'N',9,0,0,0,0,'Used to test movement.','','','',500,'',0,'0000-00-00 00:00:00',0,0); -INSERT INTO `characters` VALUES (23,'MoveMaster3','','',7,1,44.00,40.00,44.00,40.00,40.00,40.00,50.00,100.00,100.00,100.00,100.00,100.00,100,100,100,100,100,100,100,100,0,3,-40.00,0.00,-130.00,0.00,0,0,0,'','',0,NULL,'1,30,3,30,4,-50','',1,23,'N',9,0,0,0,0,'Used to test movement.','','','',500,'',0,'0000-00-00 00:00:00',0,0); -INSERT INTO `characters` VALUES (24,'MoveMaster4','','',7,1,44.00,40.00,44.00,40.00,40.00,40.00,50.00,100.00,100.00,100.00,100.00,100.00,100,100,100,100,100,100,100,100,0,3,-45.00,0.00,-130.00,0.00,0,0,0,'','',0,NULL,'1,30,3,30,4,-50','',1,24,'N',9,0,0,0,0,'Used to test movement.','','','',500,'',0,'0000-00-00 00:00:00',0,0); -INSERT INTO `characters` VALUES (25,'Fighter3','','',2,1,65.00,65.00,65.00,60.00,60.00,60.00,50.00,100.00,100.00,100.00,100.00,100.00,100,100,100,100,100,100,100,100,0,3,2.50,0.00,-132.50,0.00,0,0,0,'','',0,NULL,'1,30,2,-30','',1,6,'N',9,0,2,0,0,'Fighting with region','','','',10,'',0,'0000-00-00 00:00:00',0,0); -INSERT INTO `characters` VALUES (26,'Fighter4','','',3,1,100.00,100.00,100.00,100.00,100.00,100.00,200.00,200.00,100.00,100.00,100.00,100.00,100,100,100,100,100,100,100,100,0,3,17.50,0.00,-147.50,0.00,0,0,0,'','',0,NULL,'1,35,2,-35','',1,6,'N',9,0,2,0,0,'Fighting with region','','','',10,'',0,'0000-00-00 00:00:00',0,0); -INSERT INTO `characters` VALUES (27,'MoveMaster5A','','',7,1,44.00,40.00,44.00,40.00,40.00,40.00,50.00,100.00,100.00,100.00,100.00,100.00,100,100,100,100,100,100,100,100,0,3,-60.00,0.00,-130.00,0.00,0,0,0,'','',0,NULL,'1,30,3,30,4,-50','',1,27,'N',9,0,0,0,0,'Used to test movement.','','','',500,'',0,'0000-00-00 00:00:00',0,0); -INSERT INTO `characters` VALUES (28,'MoveMaster5B','','',7,1,44.00,40.00,44.00,40.00,40.00,40.00,50.00,100.00,100.00,100.00,100.00,100.00,100,100,100,100,100,100,100,100,0,3,-60.00,0.00,-128.00,0.00,0,0,0,'','',0,NULL,'1,30,3,30,4,-50','',1,28,'N',9,0,0,0,0,'Used to test movement.','','','',500,'',0,'0000-00-00 00:00:00',0,0); -INSERT INTO `characters` VALUES (29,'MoveMaster5C','','',7,1,44.00,40.00,44.00,40.00,40.00,40.00,50.00,100.00,100.00,100.00,100.00,100.00,100,100,100,100,100,100,100,100,0,3,-60.00,0.00,-126.00,0.00,0,0,0,'','',0,NULL,'1,30,3,30,4,-50','',1,29,'N',9,0,0,0,0,'Used to test movement.','','','',500,'',0,'0000-00-00 00:00:00',0,0); -INSERT INTO `characters` VALUES (30,'WinchBeast1','','',7,1,44.00,40.00,44.00,40.00,40.00,40.00,50.00,100.00,100.00,100.00,100.00,100.00,100,100,100,100,100,100,100,100,0,3,-50.00,0.00,-130.00,0.00,0,0,0,'','',0,NULL,'1,30,3,30,4,-50','',1,30,'N',9,0,0,0,0,'Used to test interactions with sequences.','','','',500,'',0,'0000-00-00 00:00:00',0,0); -INSERT INTO `characters` VALUES (40,'WinchMover1','','',7,1,44.00,40.00,44.00,40.00,40.00,40.00,50.00,100.00,100.00,100.00,100.00,100.00,100,100,100,100,100,100,100,100,0,3,-55.00,0.00,-130.00,0.00,0,0,0,'','',0,NULL,'1,30,3,30,4,-50','',1,31,'N',9,0,0,0,0,'Used to test interactions with sequences.','','','',500,'',0,'0000-00-00 00:00:00',0,0); -INSERT INTO `characters` VALUES (50,'FAMILIAR:Roge','Sample','',23,2,60.00,60.00,60.00,60.00,60.00,60.00,60.00,100.00,100.00,100.00,200.00,200.00,100,100,100,100,100,100,100,100,0,3,0.00,0.00,0.00,0.00,0,0,0,'','',0,'0000-00-00 00:00:00','1,-50,2,50','',0,0,'N',9,0,0,10000,1000,'A Pet Sample','','','',10000,NULL,0,'0000-00-00 00:00:00',0,0); -INSERT INTO `characters` VALUES (51,'FAMILIAR:Clacker','Sample','',24,2,60.00,60.00,60.00,60.00,60.00,60.00,60.00,100.00,100.00,100.00,200.00,200.00,100,100,100,100,100,100,100,100,0,3,0.00,0.00,0.00,0.00,0,0,0,'','',0,'0000-00-00 00:00:00','1,-50,2,50','',0,0,'N',9,0,0,10000,1000,'A Pet Sample','','','',10000,NULL,0,'0000-00-00 00:00:00',0,0); -INSERT INTO `characters` VALUES (52,'FAMILIAR:Rat','Sample','',25,2,60.00,60.00,60.00,60.00,60.00,60.00,60.00,100.00,100.00,100.00,200.00,200.00,100,100,100,100,100,100,100,100,0,3,0.00,0.00,0.00,0.00,0,0,0,'','',0,'0000-00-00 00:00:00','1,-50,2,50','',0,0,'N',9,0,0,10000,1000,'A Pet Sample','','','',10000,NULL,0,'0000-00-00 00:00:00',0,0); -INSERT INTO `characters` VALUES (53,'MoveUnderground','','',7,1,44.00,40.00,44.00,40.00,40.00,40.00,50.00,100.00,100.00,100.00,100.00,100.00,100,100,100,100,100,100,100,100,0,3,-65.00,0.00,-130.00,0.00,0,0,0,'','',0,NULL,'1,30,3,30,4,-50','',1,53,'N',9,0,0,0,0,'Used to test wander underground.','','','',500,'',0,'0000-00-00 00:00:00',0,0); +INSERT INTO `characters` VALUES (1,'Guest','Char','',0,0,144.00,40.00,44.00,40.00,40.00,40.00,0.00,100.00,0.00,100.00,216.00,200.00,34,40,10,134,100,100,100,100,0,3,-43.86,-0.01,-152.30,1.50,0,0,0,0,0,NULL,NULL,0,'0000-00-00 00:00:00','1,-50,2,50','',0,0,'N',3,2604,0,180,18,'Was born in a jar','','','',10,'',0,'0000-00-00 00:00:00',0,0); +INSERT INTO `characters` VALUES (2,'Vengeance','IsMine','',0,0,300.00,60.00,60.00,60.00,60.00,60.00,0.00,280.00,0.00,120.00,200.00,200.00,34,40,10,134,0,0,0,0,0,3,-32.03,0.00,-154.36,0.49,0,0,0,0,0,NULL,NULL,0,'2006-11-29 21:55:15','1,-40,2,50','',0,0,'N',1,14985,0,150,10,'Grew up on a ice mountain','','','',10,'<category attribute=\"Lifecycle\" name=\"Daylight\" value=\"10\" /><category attribute=\"Type\" name=\"Animal\" value=\"5\" />',3,'0000-00-00 00:00:00',0,0); +INSERT INTO `characters` VALUES (3,'Acraig','Newfie','',2,0,144.00,40.00,44.00,40.00,40.00,40.00,0.00,100.00,0.00,100.00,216.00,200.00,34,40,10,134,100,100,100,100,0,3,-61.32,-0.01,-187.16,0.00,0,0,0,0,0,NULL,NULL,0,'0000-00-00 00:00:00','1,-30,2,30','',0,0,'N',5,3798,0,150,1000,'description','','','',1000,'',0,'0000-00-00 00:00:00',0,0); +INSERT INTO `characters` VALUES (4,'MaleEnki','','',1,1,44.00,40.00,44.00,40.00,40.00,40.00,50.00,100.00,100.00,100.00,100.00,100.00,100,100,100,100,100,100,100,100,0,3,-1.00,0.00,-179.00,0.00,0,0,0,0,0,'','',0,NULL,'1,30,2,-30','',1,4,'N',9,0,0,0,0,'description','','','',10,'',0,'0000-00-00 00:00:00',0,0); +INSERT INTO `characters` VALUES (5,'Smith','','',7,1,44.00,40.00,44.00,40.00,40.00,40.00,50.00,100.00,100.00,100.00,100.00,100.00,100,100,100,100,100,100,100,100,0,3,-53.54,0.00,-155.11,0.00,0,0,0,0,0,'','',0,NULL,'','',1,5,'N',9,0,0,0,0,'description','','','',10,'',0,'0000-00-00 00:00:00',0,0); +INSERT INTO `characters` VALUES (6,'Fighter1','','',2,1,65.00,65.00,65.00,60.00,60.00,60.00,50.00,100.00,100.00,100.00,100.00,100.00,100,100,100,100,100,100,100,100,0,3,-2.00,0.00,-181.00,0.00,0,0,0,0,0,'','',0,NULL,'1,30,2,-30','',1,6,'N',9,0,2,0,0,'description','','','',10,'',0,'0000-00-00 00:00:00',0,0); +INSERT INTO `characters` VALUES (7,'Fighter2','','',3,1,100.00,100.00,100.00,100.00,100.00,100.00,200.00,200.00,100.00,100.00,100.00,100.00,100,100,100,100,100,100,100,100,0,3,-92.00,0.00,-266.00,0.00,0,0,0,0,0,'','',0,NULL,'1,35,2,-35','',1,6,'N',9,0,2,0,0,'description','','','',10,'',0,'0000-00-00 00:00:00',0,0); +INSERT INTO `characters` VALUES (8,'Merchant','','',7,1,44.00,40.00,44.00,40.00,40.00,40.00,50.00,100.00,100.00,100.00,100.00,100.00,100,100,100,100,100,100,100,100,0,3,-46.54,0.00,-151.11,0.00,0,0,0,0,0,'','',0,NULL,'1,30,3,30,4,-50','',1,8,'N',9,0,0,0,0,'description','','','',500,'',0,'0000-00-00 00:00:00', 1,0); +INSERT INTO `characters` VALUES (9,'Lady','Aren','',14,0,44.00,40.00,44.00,40.00,40.00,40.00,0.00,100.00,0.00,100.00,216.00,200.00,34,40,10,134,100,100,100,100,0,3,-43.86,-0.01,-152.30,1.50,0,0,0,0,0,NULL,NULL,0,'0000-00-00 00:00:00','1,-50,2,50','',0,0,'N',1,2604,0,180,18,'The love of Guest Char.','','','',10,'',0,'0000-00-00 00:00:00',0,0); +INSERT INTO `characters` VALUES (12,'QuestMaster1','','',7,1,44.00,40.00,44.00,40.00,40.00,40.00,50.00,100.00,100.00,100.00,100.00,100.00,100,100,100,100,100,100,100,100,0,3,-30.00,0.00,-150.00,0.00,0,0,0,0,0,'','',0,NULL,'1,30,3,30,4,-50','',1,12,'Y',9,0,0,0,0,'Used for quest testing. Type \"step1\" to start Test.','','','',500,'',0,'0000-00-00 00:00:00',0,0); +INSERT INTO `characters` VALUES (13,'QuestMaster2','','',7,1,44.00,40.00,44.00,40.00,40.00,40.00,50.00,100.00,100.00,100.00,100.00,100.00,100,100,100,100,100,100,100,100,0,3,-35.00,0.00,-150.00,0.00,0,0,0,0,0,'','',0,NULL,'1,30,3,30,4,-50','',1,13,'Y',9,0,0,0,0,'Used for quest testing. Type \"step1\" to start Test.','','','',500,'',0,'0000-00-00 00:00:00',0,0); +INSERT INTO `characters` VALUES (14,'DictMaster1','','',7,1,44.00,40.00,44.00,40.00,40.00,40.00,50.00,100.00,100.00,100.00,100.00,100.00,100,100,100,100,100,100,100,100,0,3,-40.00,0.00,-150.00,0.00,0,0,0,0,0,'','',0,NULL,'1,30,3,30,4,-50','',1,14,'N',9,0,0,0,0,'Used for quest testing. Type \"step1\" to start Test.','','','',500,'',0,'0000-00-00 00:00:00',0,0); +INSERT INTO `characters` VALUES (15,'DictMaster2','','',7,1,44.00,40.00,44.00,40.00,40.00,40.00,50.00,100.00,100.00,100.00,100.00,100.00,100,100,100,100,100,100,100,100,0,3,-45.00,0.00,-150.00,0.00,0,0,0,0,0,'','',0,NULL,'1,30,3,30,4,-50','',1,15,'N',9,0,0,0,0,'Used for quest testing. Type \"step1\" to start Test.','','','',500,'',0,'0000-00-00 00:00:00',0,0); +INSERT INTO `characters` VALUES (20,'TribeMember','','',7,1,44.00,40.00,44.00,40.00,40.00,40.00,50.00,100.00,100.00,100.00,100.00,100.00,100,100,100,100,100,100,100,100,0,3,-45.00,0.00,-150.00,0.00,0,0,0,0,0,'','',0,NULL,'1,30,3,30,4,-50','',0,20,'N',9,0,0,0,0,'Tribe member. Used in tribe testing.','','','',500,'',0,'0000-00-00 00:00:00',0,0); +INSERT INTO `characters` VALUES (21,'MoveMaster1','','',7,1,44.00,40.00,44.00,40.00,40.00,40.00,50.00,100.00,100.00,100.00,100.00,100.00,100,100,100,100,100,100,100,100,0,3,-30.00,0.00,-130.00,0.00,0,0,0,0,0,'','',0,NULL,'1,30,3,30,4,-50','',1,21,'N',9,0,0,0,0,'Used to test movement.','','','',500,'',0,'0000-00-00 00:00:00',0,0); +INSERT INTO `characters` VALUES (22,'MoveMaster2','','',7,1,44.00,40.00,44.00,40.00,40.00,40.00,50.00,100.00,100.00,100.00,100.00,100.00,100,100,100,100,100,100,100,100,0,3,-35.00,0.00,-130.00,0.00,0,0,0,0,0,'','',0,NULL,'1,30,3,30,4,-50','',1,22,'N',9,0,0,0,0,'Used to test movement.','','','',500,'',0,'0000-00-00 00:00:00',0,0); +INSERT INTO `characters` VALUES (23,'MoveMaster3','','',7,1,44.00,40.00,44.00,40.00,40.00,40.00,50.00,100.00,100.00,100.00,100.00,100.00,100,100,100,100,100,100,100,100,0,3,-40.00,0.00,-130.00,0.00,0,0,0,0,0,'','',0,NULL,'1,30,3,30,4,-50','',1,23,'N',9,0,0,0,0,'Used to test movement.','','','',500,'',0,'0000-00-00 00:00:00',0,0); +INSERT INTO `characters` VALUES (24,'MoveMaster4','','',7,1,44.00,40.00,44.00,40.00,40.00,40.00,50.00,100.00,100.00,100.00,100.00,100.00,100,100,100,100,100,100,100,100,0,3,-45.00,0.00,-130.00,0.00,0,0,0,0,0,'','',0,NULL,'1,30,3,30,4,-50','',1,24,'N',9,0,0,0,0,'Used to test movement.','','','',500,'',0,'0000-00-00 00:00:00',0,0); +INSERT INTO `characters` VALUES (25,'Fighter3','','',2,1,65.00,65.00,65.00,60.00,60.00,60.00,50.00,100.00,100.00,100.00,100.00,100.00,100,100,100,100,100,100,100,100,0,3,2.50,0.00,-132.50,0.00,0,0,0,0,0,'','',0,NULL,'1,30,2,-30','',1,6,'N',9,0,2,0,0,'Fighting with region','','','',10,'',0,'0000-00-00 00:00:00',0,0); +INSERT INTO `characters` VALUES (26,'Fighter4','','',3,1,100.00,100.00,100.00,100.00,100.00,100.00,200.00,200.00,100.00,100.00,100.00,100.00,100,100,100,100,100,100,100,100,0,3,17.50,0.00,-147.50,0.00,0,0,0,0,0,'','',0,NULL,'1,35,2,-35','',1,6,'N',9,0,2,0,0,'Fighting with region','','','',10,'',0,'0000-00-00 00:00:00',0,0); +INSERT INTO `characters` VALUES (27,'MoveMaster5A','','',7,1,44.00,40.00,44.00,40.00,40.00,40.00,50.00,100.00,100.00,100.00,100.00,100.00,100,100,100,100,100,100,100,100,0,3,-60.00,0.00,-130.00,0.00,0,0,0,0,0,'','',0,NULL,'1,30,3,30,4,-50','',1,27,'N',9,0,0,0,0,'Used to test movement.','','','',500,'',0,'0000-00-00 00:00:00',0,0); +INSERT INTO `characters` VALUES (28,'MoveMaster5B','','',7,1,44.00,40.00,44.00,40.00,40.00,40.00,50.00,100.00,100.00,100.00,100.00,100.00,100,100,100,100,100,100,100,100,0,3,-60.00,0.00,-128.00,0.00,0,0,0,0,0,'','',0,NULL,'1,30,3,30,4,-50','',1,28,'N',9,0,0,0,0,'Used to test movement.','','','',500,'',0,'0000-00-00 00:00:00',0,0); +INSERT INTO `characters` VALUES (29,'MoveMaster5C','','',7,1,44.00,40.00,44.00,40.00,40.00,40.00,50.00,100.00,100.00,100.00,100.00,100.00,100,100,100,100,100,100,100,100,0,3,-60.00,0.00,-126.00,0.00,0,0,0,0,0,'','',0,NULL,'1,30,3,30,4,-50','',1,29,'N',9,0,0,0,0,'Used to test movement.','','','',500,'',0,'0000-00-00 00:00:00',0,0); +INSERT INTO `characters` VALUES (30,'WinchBeast1','','',7,1,44.00,40.00,44.00,40.00,40.00,40.00,50.00,100.00,100.00,100.00,100.00,100.00,100,100,100,100,100,100,100,100,0,3,-50.00,0.00,-130.00,0.00,0,0,0,0,0,'','',0,NULL,'1,30,3,30,4,-50','',1,30,'N',9,0,0,0,0,'Used to test interactions with sequences.','','','',500,'',0,'0000-00-00 00:00:00',0,0); +INSERT INTO `characters` VALUES (40,'WinchMover1','','',7,1,44.00,40.00,44.00,40.00,40.00,40.00,50.00,100.00,100.00,100.00,100.00,100.00,100,100,100,100,100,100,100,100,0,3,-55.00,0.00,-130.00,0.00,0,0,0,0,0,'','',0,NULL,'1,30,3,30,4,-50','',1,31,'N',9,0,0,0,0,'Used to test interactions with sequences.','','','',500,'',0,'0000-00-00 00:00:00',0,0); +INSERT INTO `characters` VALUES (50,'FAMILIAR:Roge','Sample','',23,2,60.00,60.00,60.00,60.00,60.00,60.00,60.00,100.00,100.00,100.00,200.00,200.00,100,100,100,100,100,100,100,100,0,3,0.00,0.00,0.00,0.00,0,0,0,0,0,'','',0,'0000-00-00 00:00:00','1,-50,2,50','',0,0,'N',9,0,0,10000,1000,'A Pet Sample','','','',10000,NULL,0,'0000-00-00 00:00:00',0,0); +INSERT INTO `characters` VALUES (51,'FAMILIAR:Clacker','Sample','',24,2,60.00,60.00,60.00,60.00,60.00,60.00,60.00,100.00,100.00,100.00,200.00,200.00,100,100,100,100,100,100,100,100,0,3,0.00,0.00,0.00,0.00,0,0,0,0,0,'','',0,'0000-00-00 00:00:00','1,-50,2,50','',0,0,'N',9,0,0,10000,1000,'A Pet Sample','','','',10000,NULL,0,'0000-00-00 00:00:00',0,0); +INSERT INTO `characters` VALUES (52,'FAMILIAR:Rat','Sample','',25,2,60.00,60.00,60.00,60.00,60.00,60.00,60.00,100.00,100.00,100.00,200.00,200.00,100,100,100,100,100,100,100,100,0,3,0.00,0.00,0.00,0.00,0,0,0,0,0,'','',0,'0000-00-00 00:00:00','1,-50,2,50','',0,0,'N',9,0,0,10000,1000,'A Pet Sample','','','',10000,NULL,0,'0000-00-00 00:00:00',0,0); +INSERT INTO `characters` VALUES (53,'MoveUnderground','','',7,1,44.00,40.00,44.00,40.00,40.00,40.00,50.00,100.00,100.00,100.00,100.00,100.00,100,100,100,100,100,100,100,100,0,3,-65.00,0.00,-130.00,0.00,0,0,0,0,0,'','',0,NULL,'1,30,3,30,4,-50','',1,53,'N',9,0,0,0,0,'Used to test wander underground.','','','',500,'',0,'0000-00-00 00:00:00',0,0); -INSERT INTO `characters` VALUES (54,'Gertie','Hollaback','',1,1,44.00,40.00,44.00,40.00,40.00,40.00,50.00,100.00,100.00,100.00,100.00,100.00,100,100,100,100,100,100,100,100,0,3,-1.00,0.00,-178.00,0.00,0,0,0,'','',0,NULL,'1,30,2,-30','',1,4,'N',9,0,0,0,0,'description','','','',10,'',0,'0000-00-00 00:00:00',0,0); -INSERT INTO `characters` VALUES (55,'Reginald','Hartlepool','',2,1,44.00,40.00,44.00,40.00,40.00,40.00,50.00,100.00,100.00,100.00,100.00,100.00,100,100,100,100,100,100,100,100,0,3,-1.00,0.00,-177.00,0.00,0,0,0,'','',0,NULL,'1,30,2,-30','',1,4,'N',9,0,0,0,0,'description','','','',10,'',0,'0000-00-00 00:00:00',0,0); -INSERT INTO `characters` VALUES (56,'Butch','','',3,1,44.00,40.00,44.00,40.00,40.00,40.00,50.00,100.00,100.00,100.00,100.00,100.00,100,100,100,100,100,100,100,100,0,3,-1.00,0.00,-176.00,0.00,0,0,0,'','',0,NULL,'1,30,2,-30','',1,4,'N',9,0,0,0,0,'description','','','',10,'',0,'0000-00-00 00:00:00',0,0); -INSERT INTO `characters` VALUES (57,'Loudon','','',4,1,44.00,40.00,44.00,40.00,40.00,40.00,50.00,100.00,100.00,100.00,100.00,100.00,100,100,100,100,100,100,100,100,0,3,-1.00,0.00,-175.00,0.00,0,0,0,'','',0,NULL,'1,30,2,-30','',1,4,'N',9,0,0,0,0,'description','','','',10,'',0,'0000-00-00 00:00:00',0,0); -INSERT INTO `characters` VALUES (58,'Cabot','','',5,1,44.00,40.00,44.00,40.00,40.00,40.00,50.00,100.00,100.00,100.00,100.00,100.00,100,100,100,100,100,100,100,100,0,3,-1.00,0.00,-174.00,0.00,0,0,0,'','',0,NULL,'1,30,2,-30','',1,4,'N',9,0,0,0,0,'description','','','',10,'',0,'0000-00-00 00:00:00',0,0); +INSERT INTO `characters` VALUES (54,'Gertie','Hollaback','',1,1,44.00,40.00,44.00,40.00,40.00,40.00,50.00,100.00,100.00,100.00,100.00,100.00,100,100,100,100,100,100,100,100,0,3,-1.00,0.00,-178.00,0.00,0,0,0,0,0,'','',0,NULL,'1,30,2,-30','',1,4,'N',9,0,0,0,0,'description','','','',10,'',0,'0000-00-00 00:00:00',0,0); +INSERT INTO `characters` VALUES (55,'Reginald','Hartlepool','',2,1,44.00,40.00,44.00,40.00,40.00,40.00,50.00,100.00,100.00,100.00,100.00,100.00,100,100,100,100,100,100,100,100,0,3,-1.00,0.00,-177.00,0.00,0,0,0,0,0,'','',0,NULL,'1,30,2,-30','',1,4,'N',9,0,0,0,0,'description','','','',10,'',0,'0000-00-00 00:00:00',0,0); +INSERT INTO `characters` VALUES (56,'Butch','','',3,1,44.00,40.00,44.00,40.00,40.00,40.00,50.00,100.00,100.00,100.00,100.00,100.00,100,100,100,100,100,100,100,100,0,3,-1.00,0.00,-176.00,0.00,0,0,0,0,0,'','',0,NULL,'1,30,2,-30','',1,4,'N',9,0,0,0,0,'description','','','',10,'',0,'0000-00-00 00:00:00',0,0); +INSERT INTO `characters` VALUES (57,'Loudon','','',4,1,44.00,40.00,44.00,40.00,40.00,40.00,50.00,100.00,100.00,100.00,100.00,100.00,100,100,100,100,100,100,100,100,0,3,-1.00,0.00,-175.00,0.00,0,0,0,0,0,'','',0,NULL,'1,30,2,-30','',1,4,'N',9,0,0,0,0,'description','','','',10,'',0,'0000-00-00 00:00:00',0,0); +INSERT INTO `characters` VALUES (58,'Cabot','','',5,1,44.00,40.00,44.00,40.00,40.00,40.00,50.00,100.00,100.00,100.00,100.00,100.00,100,100,100,100,100,100,100,100,0,3,-1.00,0.00,-174.00,0.00,0,0,0,0,0,'','',0,NULL,'1,30,2,-30','',1,4,'N',9,0,0,0,0,'description','','','',10,'',0,'0000-00-00 00:00:00',0,0); -INSERT INTO `characters` VALUES (59,'NPCroom1','','',9999,1,44.00,40.00,44.00,40.00,40.00,40.00,50.00,100.00,100.00,100.00,100.00,100.00,100,100,100,100,100,100,100,100,0,3,-40.08,0.00,-191.86,0.00,0,0,0,'','',0,NULL,'1,30,2,-30','',1,4,'Y',9,0,0,0,0,'NPCroom1 exploration area.','','','',10,'',0,'0000-00-00 00:00:00',0,0); -INSERT INTO `characters` VALUES (60,'NPCroom2','','',9999,1,44.00,40.00,44.00,40.00,40.00,40.00,50.00,100.00,100.00,100.00,100.00,100.00,100,100,100,100,100,100,100,100,0,6,-32.77,2.61,-0.38,0.00,0,0,0,'','',0,NULL,'1,30,2,-30','',1,4,'Y',9,0,0,0,0,'NPCroom2 exploration area.','','','',10,'',0,'0000-00-00 00:00:00',0,0); +INSERT INTO `characters` VALUES (59,'NPCroom1','','',9999,1,44.00,40.00,44.00,40.00,40.00,40.00,50.00,100.00,100.00,100.00,100.00,100.00,100,100,100,100,100,100,100,100,0,3,-40.08,0.00,-191.86,0.00,0,0,0,0,0,'','',0,NULL,'1,30,2,-30','',1,4,'Y',9,0,0,0,0,'NPCroom1 exploration area.','','','',10,'',0,'0000-00-00 00:00:00',0,0); +INSERT INTO `characters` VALUES (60,'NPCroom2','','',9999,1,44.00,40.00,44.00,40.00,40.00,40.00,50.00,100.00,100.00,100.00,100.00,100.00,100,100,100,100,100,100,100,100,0,6,-32.77,2.61,-0.38,0.00,0,0,0,0,0,'','',0,NULL,'1,30,2,-30','',1,4,'Y',9,0,0,0,0,'NPCroom2 exploration area.','','','',10,'',0,'0000-00-00 00:00:00',0,0); /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; Modified: trunk/src/server/database/mysql/guilds.sql =================================================================== --- trunk/src/server/database/mysql/guilds.sql 2009-07-12 19:15:12 UTC (rev 4001) +++ trunk/src/server/database/mysql/guilds.sql 2009-07-12 19:21:55 UTC (rev 4002) @@ -15,6 +15,7 @@ date_created datetime NOT NULL DEFAULT '0000-00-00 00:00:00' , karma_points int(10) NOT NULL DEFAULT '0' , secret_ind char(1) , + max_guild_points int(10) NOT NULL DEFAULT '100' COMMENT 'Stores the maximum amount of gp allowed for assignment in this guild', motd char(200) , alliance int(11), bank_money_circles int(10) unsigned NOT NULL default '0', @@ -32,5 +33,5 @@ # Dumping data for table 'guilds' # -INSERT INTO guilds VALUES("1","Insomniac Developers","2","www.yahoo.com","2002-05-08 00:07:37","0","N","Guild MOTD", 1, 1, 1, 1, 1); -INSERT INTO guilds VALUES("11","Karmic Fanboys","1","www.linux.org","2003-07-25 00:07:37","0","N","", 1, 0, 0, 0, 0); +INSERT INTO guilds VALUES("1","Insomniac Developers","2","www.yahoo.com","2002-05-08 00:07:37","0","N",100,"Guild MOTD", 1, 1, 1, 1, 1); +INSERT INTO guilds VALUES("11","Karmic Fanboys","1","www.linux.org","2003-07-25 00:07:37","0","N",100,"", 1, 0, 0, 0, 0); Modified: trunk/src/server/database/mysql/server_options.sql =================================================================== --- trunk/src/server/database/mysql/server_options.sql 2009-07-12 19:15:12 UTC (rev 4001) +++ trunk/src/server/database/mysql/server_options.sql 2009-07-12 19:21:55 UTC (rev 4002) @@ -28,7 +28,7 @@ # Dumping data for table server_options # -INSERT INTO `server_options` VALUES ('db_version','1224'); +INSERT INTO `server_options` VALUES ('db_version','1225'); INSERT INTO `server_options` VALUES ('game_time','15:00'); INSERT INTO `server_options` VALUES ('game_date','100-1-1'); INSERT INTO `server_options` VALUES ('standard_motd','This is the message of the day from server_options table.'); Modified: trunk/src/server/database/mysql/upgrade_schema.sql =================================================================== --- trunk/src/server/database/mysql/upgrade_schema.sql 2009-07-12 19:15:12 UTC (rev 4001) +++ trunk/src/server/database/mysql/upgrade_schema.sql 2009-07-12 19:21:55 UTC (rev 4002) @@ -1246,8 +1246,13 @@ ADD COLUMN `audio_path3` VARCHAR(100) DEFAULT NULL COMMENT 'This holds an optional VFS path to a speech file to be sent to the client and played on demand for response3.' AFTER `audio_path2`, ADD COLUMN `audio_path4` VARCHAR(100) DEFAULT NULL COMMENT 'This holds an optional VFS path to a speech file to be sent to the client and played on demand for response4.' AFTER `audio_path3`, ADD COLUMN `audio_path5` VARCHAR(100) DEFAULT NULL COMMENT 'This holds an optional VFS path to a speech file to be sent to the client and played on demand for response5.' AFTER `audio_path4`; + +#1225 - Stefano Angeleri - Added max guild points and per character permissions +ALTER TABLE `guilds` ADD COLUMN `max_guild_points` INT(10) NOT NULL DEFAULT 100 COMMENT 'Stores the maximum amount of gp allowed for assignment in this guild' AFTER `secret_ind`; +ALTER TABLE `characters` ADD COLUMN `guild_additional_privileges` SMALLINT(3) UNSIGNED NOT NULL DEFAULT 0 COMMENT 'Contains a bitfield with the additional priviledges assigned to this char (additional to the guild level it\'s in)' AFTER `guild_level`, + ADD COLUMN `guild_denied_privileges` SMALLINT(3) UNSIGNED NOT NULL DEFAULT 0 COMMENT 'Contains a bitfield with the removed priviledges from this char (removed from the guild level it\'s in)' AFTER `guild_additional_privileges`; +UPDATE `server_options` SET `option_value`='1225' WHERE `option_name`='db_version'; - # Insert your upgrade before this line. Remember when you set a new db_version # to update the server_options.sql file and update psserver.cpp as well. # This to ensure that everything is working if you use the create_all.sql to Modified: trunk/src/server/guildmanager.cpp =================================================================== --- trunk/src/server/guildmanager.cpp 2009-07-12 19:15:12 UTC (rev 4001) +++ trunk/src/server/guildmanager.cpp 2009-07-12 19:21:55 UTC (rev 4002) @@ -283,6 +283,14 @@ { NewAlliance(msg,client); } + else if (msg.command == "/getmemberpermissions") + { + GetMemberPermissions(msg,client); + } + else if (msg.command == "/setmemberpermissions") + { + SetMemberPermissions(msg,client); + } else if (msg.command == "/allianceinvite") { AllianceInvite(msg,client); @@ -346,6 +354,9 @@ case psGUIGuildMessage::SET_MEMBER_POINTS: HandleSetMemberPoints(client, doc->GetRoot()); break; + case psGUIGuildMessage::SET_MAX_GUILD_POINTS: + HandleSetMaxMemberPoints(client, doc->GetRoot()); + break; case psGUIGuildMessage::SET_MEMBER_PUBLIC_NOTES: HandleSetMemberNotes(client, doc->GetRoot(), true); break; @@ -402,13 +413,13 @@ */ bool GuildManager::CheckClientRights(Client * client, GUILD_PRIVILEGE priv) { - psGuildLevel * level; + psGuildMember *member; - level = client->GetActor()->GetGuildLevel(); - if (level == NULL) + member = client->GetActor()->GetGuildMembership(); + if (member == NULL) return false; - if (level->HasRights(priv)) + if (member->HasRights(priv)) return true; else return false; @@ -595,37 +606,8 @@ return NULL; } -void GuildManager::HandleSetLevelRight(Client * client, iDocumentNode* root) +bool GuildManager::ParseRightString(csString privilege, GUILD_PRIVILEGE& right) { - csRef<iDocumentNode> topNode = root->GetNode("l"); - if (!topNode) - { - Error1("Error in XML: Can't find node l"); - return; - } - int level = topNode->GetAttributeValueAsInt("level"); - csString privilege = topNode->GetAttributeValue("privilege"); - csString state = topNode->GetAttributeValue("state"); - - psGuildInfo * guild = client->GetCharacterData()->GetGuild(); - if (guild == NULL) - { - psserver->Send... [truncated message content] |