Added item link functionality to #summonitem (thanks Kinglykrab!)

This commit is contained in:
Uleat 2016-01-13 15:10:21 -05:00
parent 23758d5e90
commit 6db397f07d
2 changed files with 47 additions and 29 deletions

View File

@ -9,7 +9,7 @@ Athrogate: Adding ClearCompassMark() to Lua.
- Lua didn't have ClearCompassMark(). Perl already had this.
== 01/12/2016 ==
Uleat: Fix for tradeskill containers remaining locked after a RoF+ client leaves. Intermediary fix for RoF+ clients accessing tradeskill containers when in use by another player.
Uleat: Fix for tradeskill containers remaining locked after a RoF+ client leaves. Intermediary fix for RoF+ clients accessing tradeskill containers when in use by another player (thanks Natedog!)
== 12/29/2015 ==
Akkadius: Implemented standardized zone controller scripts (Rule Zone, UseZoneController) Defaulted to true

View File

@ -5484,10 +5484,28 @@ void command_interrupt(Client *c, const Seperator *sep)
void command_summonitem(Client *c, const Seperator *sep)
{
if (!sep->IsNumber(1))
c->Message(0, "Usage: #summonitem [item id] [charges], charges are optional");
uint32 itemid = 0;
std::string cmd_msg = sep->msg;
size_t link_open = cmd_msg.find('\x12');
size_t link_close = cmd_msg.find_last_of('\x12');
if (link_open != link_close && (cmd_msg.length() - link_open) > EmuConstants::TEXT_LINK_BODY_LENGTH) {
TextLinkBody_Struct link_body;
Client::TextLink::DegenerateLinkBody(link_body, cmd_msg.substr(link_open + 1, EmuConstants::TEXT_LINK_BODY_LENGTH));
itemid = link_body.item_id;
}
else if (!sep->IsNumber(1)) {
c->Message(0, "Usage: #summonitem [item id | link] [charges], charges are optional");
return;
}
else {
uint32 itemid = atoi(sep->arg[1]);
itemid = atoi(sep->arg[1]);
}
if (!itemid) {
c->Message(0, "A valid item id number is required (derived: 0)");
return;
}
int16 item_status = 0;
const Item_Struct* item = database.GetItem(itemid);
if (item) {
@ -5513,7 +5531,7 @@ void command_summonitem(Client *c, const Seperator *sep)
else {
c->SummonItem(itemid);
}
}
}
void command_giveitem(Client *c, const Seperator *sep)