示例#1
0
GoodType nofMetalworker::GetOrderedTool()
{
    // qx:tools
    int prio = -1;
    int tool = -1;

    GameClientPlayer& owner = gwg->GetPlayer(player);
    for (unsigned i = 0; i < TOOL_COUNT; ++i)
    {
        if (owner.tools_ordered[i] > 0 && (owner.toolsSettings_[i] > prio) )
        {
            prio = owner.toolsSettings_[i];
            tool = i;
        }
    }

    if (tool != -1)
    {
        --owner.tools_ordered[tool];

        if ( (player == GAMECLIENT.GetPlayerID()) && (ToolsOrderedTotal() == 0) )
        {
            GAMECLIENT.SendPostMessage( new PostMsg( _("Completed the ordered amount of tools."), PMC_GENERAL ) );
        }

        iwTools::UpdateOrders();
        return TOOLS_SETTINGS_IDS[tool];
    }
    return GD_NOTHING;
}
示例#2
0
GoodType nofMetalworker::GetOrderedTool()
{
    // qx:tools
    int prio = -1;
    int tool = -1;

    GameClientPlayer& owner = gwg->GetPlayer(player);
    for (unsigned i = 0; i < TOOL_COUNT; ++i)
    {
        if (owner.tools_ordered[i] > 0 && (owner.toolsSettings_[i] > prio) )
        {
            prio = owner.toolsSettings_[i];
            tool = i;
        }
    }

    if (tool != -1)
    {
        --owner.tools_ordered[tool];

        if (ToolsOrderedTotal() == 0)
            SendPostMessage(player, new PostMsg(GetEvMgr().GetCurrentGF(), _("Completed the ordered amount of tools."), PMC_GENERAL));

        gwg->GetNotifications().publish(ToolNote(ToolNote::OrderCompleted, player));
        return TOOLS_SETTINGS_IDS[tool];
    }
    return GD_NOTHING;
}