1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-16 06:49:55 +00:00
openmw-tes3mp/apps/openmw-mp/Script/Functions/Items.cpp
2016-08-30 12:20:39 +08:00

70 lines
No EOL
2.1 KiB
C++

//
// Created by koncord on 02.03.16.
//
#include "Items.hpp"
#include <apps/openmw-mp/Script/ScriptFunctions.hpp>
#include <components/openmw-mp/NetworkMessages.hpp>
#include <apps/openmw-mp/Networking.hpp>
#include <components/misc/stringops.hpp>
void ItemFunctions::AddItem(unsigned short pid, const char* itemName, unsigned short count) noexcept
{
/*Player *player;
GET_PLAYER(pid, player,);
mwmp::Networking::Get().GetController()->GetPacket(ID_GAME_UPDATE_BASESTATS)->Send(player, false);
mwmp::Networking::Get().GetController()->GetPacket(ID_GAME_UPDATE_BASESTATS)->Send(player, true);*/
LOG_MESSAGE(Log::LOG_WARN, "%s", "stub");
}
void ItemFunctions::EquipItem(unsigned short pid, unsigned short slot, const char *itemName, unsigned short count) noexcept
{
Player *player;
GET_PLAYER(pid, player,);
player->EquipedItem(slot)->refid = itemName;
player->EquipedItem(slot)->count = count;
mwmp::Networking::Get().GetController()->GetPacket(ID_GAME_UPDATE_EQUIPED)->Send(player, false);
mwmp::Networking::Get().GetController()->GetPacket(ID_GAME_UPDATE_EQUIPED)->Send(player, true);
}
void ItemFunctions::UnequipItem(unsigned short pid, unsigned short slot) noexcept
{
LOG_MESSAGE(Log::LOG_WARN, "%s", "stub");
//ItemFunctions::EquipItem(pid, slot, "", 0);
}
const char *ItemFunctions::GetItemSlot(unsigned short pid, unsigned short slot) noexcept
{
/*Player *player;
GET_PLAYER(pid, player, 0);
return player->EquipedItem(slot)->refid.c_str();*/
LOG_MESSAGE(Log::LOG_WARN, "%s", "stub");
return "";
}
bool ItemFunctions::HasItemEquipped(unsigned short pid, const char* itemName)
{
Player *player;
GET_PLAYER(pid, player, false);
for (int slot = 0; slot < 27; slot ++)
if (Misc::StringUtils::ciEqual(player->EquipedItem(slot)->refid, itemName))
return true;
return false;
}
void ItemFunctions::RemoveItem(unsigned short pid, const char* itemName, unsigned short count) noexcept
{
LOG_MESSAGE(Log::LOG_WARN, "%s", "stub");
}
void ItemFunctions::GetItemCount(unsigned short pid, const char* itemName) noexcept
{
LOG_MESSAGE(Log::LOG_WARN, "%s", "stub");
}