-
Notifications
You must be signed in to change notification settings - Fork 40
Update gm.cpp #87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Update gm.cpp #87
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -114,6 +114,7 @@ ACMD(do_exp); | |
| ACMD(do_resetexp); | ||
| ACMD(do_starthoneybee); | ||
| ACMD(do_stophoneybee); | ||
| ACMD(do_createguild); | ||
| ACMD(do_deleteguild); | ||
| ACMD(do_cancelah); | ||
| ACMD(do_addmudosa); | ||
|
|
@@ -169,6 +170,7 @@ struct command_info cmd_info[] = | |
| { L"@resetexp", do_resetexp, ADMIN_LEVEL_NONE }, | ||
| { L"@starthoneybee", do_starthoneybee, ADMIN_LEVEL_COMMUNITY_MANAGER }, | ||
| { L"@stophoneybee", do_stophoneybee, ADMIN_LEVEL_COMMUNITY_MANAGER }, | ||
| { L"@createguild", do_createguild, ADMIN_LEVEL_GAME_MASTER }, // Haven't tested if it works for others. Create a single party first. | ||
| { L"@deleteguild", do_deleteguild, ADMIN_LEVEL_COMMUNITY_MANAGER }, | ||
| { L"@cancelah", do_cancelah, ADMIN_LEVEL_GAME_MASTER }, | ||
| { L"@addmudosa", do_addmudosa, ADMIN_LEVEL_ADMIN }, | ||
|
|
@@ -1576,6 +1578,48 @@ ACMD(do_stophoneybee) | |
| NTL_PRINT(PRINT_APP, "HoneybeeEvent Stopped"); | ||
| } | ||
|
|
||
| // Maybe remove later after testing if it's needed. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Below defines are already defined on
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So that would be the better choice? I could change and test it later.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, that way we avoid code duplicity. |
||
| #ifndef NTL_MIN_SIZE_GUILD_NAME | ||
| #define NTL_MIN_SIZE_GUILD_NAME 3 | ||
| #endif | ||
| #ifndef NTL_MAX_SIZE_GUILD_NAME | ||
| #define NTL_MAX_SIZE_GUILD_NAME 16 | ||
| #endif | ||
|
|
||
| ACMD(do_createguild) | ||
| { | ||
| CGameServer* app = (CGameServer*)g_pApp; | ||
|
|
||
| pToken->PopToPeek(); | ||
| std::wstring wTok = pToken->PeekNextToken(NULL, &iLine); | ||
|
|
||
| std::string name = ws2s(wTok); // keep storage alive | ||
| if (name.empty()) | ||
| return; | ||
|
|
||
| // Basic validation (optional) | ||
| if (name.length() < NTL_MIN_SIZE_GUILD_NAME || name.length() > NTL_MAX_SIZE_GUILD_NAME) | ||
| return; | ||
| if (name.find_first_not_of("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890") != std::string::npos) | ||
| return; | ||
|
|
||
| WCHAR* wchName = Ntl_MB2WC((char*)name.c_str()); | ||
|
|
||
| CNtlPacket cPacket(sizeof(sGT_GUILD_CREATE)); | ||
| sGT_GUILD_CREATE* req = (sGT_GUILD_CREATE*)cPacket.GetPacketData(); | ||
| req->wOpCode = GT_GUILD_CREATE; | ||
| req->creatorCharId = pPlayer->GetCharID(); | ||
| NTL_SAFE_WCSCPY(req->wszGuildName, wchName); | ||
| cPacket.SetPacketLen(sizeof(sGT_GUILD_CREATE)); | ||
|
|
||
| app->SendTo(app->GetChatServerSession(), &cPacket); | ||
|
|
||
| Ntl_CleanUpHeapStringW(wchName); | ||
|
|
||
| // Strongly recommend a log so you can prove it fired | ||
| ERR_LOG(LOG_USER, "GM @createguild fired: charId=%u name=%s", pPlayer->GetCharID(), name.c_str()); | ||
| } | ||
|
|
||
| ACMD(do_deleteguild) | ||
| { | ||
| CGameServer* app = (CGameServer*)g_pApp; | ||
|
|
@@ -1868,4 +1912,4 @@ ACMD(do_removeskillscd) | |
| ACMD(do_test) | ||
| { | ||
| pPlayer->SendCharStateFalling(NTL_MOVE_NONE); | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.