|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
05-29-2011, 12:31 AM
|
|
Administrator
|
|
Join Date: Feb 2009
Location: MN
Posts: 2,071
|
|
COMMITTED: quest::CreateGuild(guild_name, leader);
I have made this functionality to approve requested guild names via Perl. You can also have players create their own guilds but may require extra steps to filter through bad naming.
This is a quest:: creation of the Guild Creation function:
Debugging and messages are sent through GMsay channel.
Usage:
Code:
sub EVENT_SAY{
if(quest::CreateGuild("Rapid Fire", $client->GetName())){
$client->Message(15, "Guild has been created successfully");
}
else{
$client->Message(15, "Guild creation error");
}
}
Code:
Index: zone/perlparser.cpp
===================================================================
--- zone/perlparser.cpp (revision 1920)
+++ zone/perlparser.cpp (working copy)
@@ -1234,6 +1234,21 @@
XSRETURN_EMPTY;
}
+XS(XS__CreateGuild);
+XS(XS__CreateGuild)
+{
+ dXSARGS;
+ if (items != 2)
+ Perl_croak(aTHX_ "Usage: CreateGuild(guild_name, leader)");
+
+ char * guild_name = (char *)SvPV_nolen(ST(0));
+ char * leader = (char *)SvPV_nolen(ST(1));
+
+ quest_manager.CreateGuild(guild_name, leader);
+
+ XSRETURN_EMPTY;
+}
+
XS(XS__settime);
XS(XS__settime)
{
@@ -3218,6 +3233,7 @@
newXS(strcpy(buf, "faction"), XS__faction, file);
newXS(strcpy(buf, "setsky"), XS__setsky, file);
newXS(strcpy(buf, "setguild"), XS__setguild, file);
+ newXS(strcpy(buf, "CreateGuild"), XS__CreateGuild, file);
newXS(strcpy(buf, "settime"), XS__settime, file);
newXS(strcpy(buf, "itemlink"), XS__itemlink, file);
newXS(strcpy(buf, "signal"), XS__signal, file);
Index: zone/questmgr.cpp
===================================================================
--- zone/questmgr.cpp (revision 1920)
+++ zone/questmgr.cpp (working copy)
@@ -1021,6 +1021,33 @@
}
}
+void QuestManager::CreateGuild(const char *guild_name, const char *leader) {
+ int32 cid = database.GetCharacterID(leader);
+ char hString[250];
+ if (cid == 0) {
+ worldserver.SendEmoteMessage(0, 0, 80, 15, "%s", "Guild Creation: Guild leader not found.");
+ return;
+ }
+
+ int32 tmp = guild_mgr.FindGuildByLeader(cid);
+ if (tmp != GUILD_NONE) {
+ sprintf(hString, "Guild Creation: Error: %s already is the leader of DB# %i '%s'.", leader, tmp, guild_mgr.GetGuildName(tmp));
+ worldserver.SendEmoteMessage(0, 0, 80, 15, "%s", hString);
+ }
+ else {
+ int32 gid = guild_mgr.CreateGuild(guild_name, cid);
+ if (gid == GUILD_NONE)
+ worldserver.SendEmoteMessage(0, 0, 80, 15, "%s", "Guild Creation: Guild creation failed");
+ else {
+ sprintf(hString, "Guild Creation: Guild created: Leader: %i, number %i: %s", cid, gid, leader);
+ worldserver.SendEmoteMessage(0, 0, 80, 15, "%s", hString);
+ if(!guild_mgr.SetGuild(cid, gid, GUILD_LEADER))
+ worldserver.SendEmoteMessage(0, 0, 80, 15, "%s", "Unable to set guild leader's guild in the database. Your going to have to run #guild set");
+ }
+
+ }
+}
+
void QuestManager::settime(int8 new_hour, int8 new_min) {
if (zone)
zone->SetTime(new_hour + 1, new_min);
Index: zone/questmgr.h
===================================================================
--- zone/questmgr.h (revision 1920)
+++ zone/questmgr.h (working copy)
@@ -112,6 +112,7 @@
void faction(int faction_id, int faction_value);
void setsky(uint8 new_sky);
void setguild(int32 new_guild_id, int8 new_rank);
+ void CreateGuild(const char *guild_name, const char *leader);
void settime(int8 new_hour, int8 new_min);
void itemlink(int item_id);
void signal(int npc_id, int wait_ms = 0);
|
|
|
|
05-29-2011, 02:53 AM
|
|
Demi-God
|
|
Join Date: May 2007
Location: b
Posts: 1,447
|
|
committed in r1921
|
05-29-2011, 05:07 AM
|
|
Developer
|
|
Join Date: Mar 2003
Posts: 1,497
|
|
Ah, disregard. Already checked by guild_mgr.
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -4. The time now is 03:08 PM.
|
|
|
|
|
|
|
|
|
|
|
|
|