Eluna change sendmail not req sender

This commit is contained in:
Rochet2
2014-03-27 13:03:36 +02:00
committed by Foereaper
parent f31561ea3e
commit fc0e9a1a78
2 changed files with 10 additions and 10 deletions

View File

@@ -926,15 +926,15 @@ namespace LuaGlobalFunctions
int SendMail(lua_State* L)
{
int i = 0;
std::string subject = luaL_checkstring(L, ++i);
std::string text = luaL_checkstring(L, ++i);
uint32 receiverGUIDLow = luaL_checkunsigned(L, ++i);
Player* senderPlayer = sEluna->CHECKOBJ<Player>(L, ++i);
uint32 stationary = luaL_optunsigned(L, ++i, MAIL_STATIONERY_DEFAULT);
uint32 delay = luaL_optunsigned(L, ++i, 0);
int32 argAmount = lua_gettop(L);
std::string subject = sEluna->CHECKVAL<std::string>(L, ++i);
std::string text = sEluna->CHECKVAL<std::string>(L, ++i);
uint32 receiverGUIDLow = sEluna->CHECKVAL<uint32>(L, ++i);
uint32 senderGUIDLow = sEluna->CHECKVAL<uint32>(L, ++i, 0);
uint32 stationary = sEluna->CHECKVAL<uint32>(L, ++i, MAIL_STATIONERY_DEFAULT);
uint32 delay = sEluna->CHECKVAL<uint32>(L, ++i, 0);
int argAmount = lua_gettop(L);
MailSender sender(MAIL_NORMAL, senderPlayer ? senderPlayer->GetGUIDLow() : 0, (MailStationery)stationary);
MailSender sender(MAIL_NORMAL, senderGUIDLow, (MailStationery)stationary);
MailDraft draft(subject, text);
#ifndef MANGOS
@@ -961,7 +961,7 @@ namespace LuaGlobalFunctions
luaL_error(L, "Item entry %d has invalid amount %d", entry, amount);
continue;
}
if (Item* item = Item::CreateItem(entry, amount, senderPlayer ? senderPlayer : 0))
if (Item* item = Item::CreateItem(entry, amount))
{
#ifdef MANGOS
item->SaveToDB();

View File

@@ -92,7 +92,7 @@ void RegisterGlobals(lua_State* L)
lua_register(L, "Kick", &LuaGlobalFunctions::Kick); // Kick(player) - Kicks given player
lua_register(L, "Ban", &LuaGlobalFunctions::Ban); // Ban(banMode(integer), nameOrIP(string), duration(string), reason(string), player(whoBanned)) - Banmode: 0 account, 1 character, 2 IP
lua_register(L, "SaveAllPlayers", &LuaGlobalFunctions::SaveAllPlayers); // SaveAllPlayers() - Saves all players
lua_register(L, "SendMail", &LuaGlobalFunctions::SendMail); // SendMail(subject, text, receiverLowGUID[, sender, stationary, delay, itemEntry, itemAmount, itemEntry2, itemAmount2...]) - Sends a mail to player with lowguid. use nil to use default values on optional arguments. Sender is an optional player object. UNDOCUMENTED
lua_register(L, "SendMail", &LuaGlobalFunctions::SendMail); // SendMail(subject, text, receiverLowGUID[, senderLowGUID, stationary, delay, itemEntry, itemAmount, itemEntry2, itemAmount2...]) - Sends a mail to player with lowguid. use nil to use default values on optional arguments. UNDOCUMENTED
lua_register(L, "AddTaxiPath", &LuaGlobalFunctions::AddTaxiPath); // AddTaxiPath(pathTable, mountA, mountH[, price, pathId]) - Adds a new taxi path. Returns the path's ID. Will replace an existing path if pathId provided and already used. path table structure: T = {{map, x, y, z[, actionFlag, delay, arrivalEvId, departEvId]}, {...}, ...} UDOCUMENTED
lua_register(L, "AddCorpse", &LuaGlobalFunctions::AddCorpse); // AddCorpse(corpse) - Adds the player's corpse to the world. More specifically, the cell.
lua_register(L, "RemoveCorpse", &LuaGlobalFunctions::RemoveCorpse); // RemoveCorpse(corpse) - Removes the player's corpse from the world.