コード例 #1
0
void do_GMSilence(CPC *a1, char *a2)
{
    CPC *v2; // [sp+Ch] [bp-Ch]@7
    int v4; // [sp+14h] [bp-4h]@9
    char *v5; // [sp+24h] [bp+Ch]@4

    if(a2)
    {
        if(*a2)
        {
            v5 = AnyOneArg(a2, g_buf, 0);
            if(strlen(g_buf) > 3)
            {
                for(int i = 0; i < gserver.Unk24.Unk32768; ++i)
                {
                    v2 = gserver.Unk24.Unk0[i];
                    if(v2 && !strcmp(v2->Unk8, g_buf))
                    {
                        v5 = AnyOneArg(v5, g_buf, 0);
                        v4 = atoi(g_buf);

                        if(v4 <= 0)
                            return;

                        v2->Unk784 = 10 * v4 + gserver.Unk41248;
                    }
                }
            }
        }
    }
}
コード例 #2
0
void do_GMGoto(CPC *a1, char *a2)
{
    char v4; // [sp+1Bh] [bp-Dh]@10
    float v5; // [sp+1Ch] [bp-Ch]@7
    float v6; // [sp+24h] [bp-4h]@4
    char *v7; // [sp+34h] [bp+Ch]@4
    char *v8; // [sp+34h] [bp+Ch]@7

    *g_buf = 0;
    if(a2 && *a2)
    {
        v7 = AnyOneArg(a2, g_buf, 0);
        v6 = atof(g_buf);

        if(v7 && *v7)
        {
            v8 = AnyOneArg(v7, g_buf, 0);
            v5 = atof(g_buf);

            if(v8 && *v8)
            {
                AnyOneArg(v8, g_buf, 0);
                v4 = atoi(g_buf);

                if(v4 >= 0 && v4 <= 2 * (a1->Unk408->Unk28 - 1) && v6 >= 0.0 && v5 >= 0.0 && v6 < a1->Unk408->Unk32[v4/2].Unk0 && v5 < a1->Unk408->Unk32[v4/2].Unk4) // NOT SURE -> CHECK
                    GoTo(a1, v4, v6, v5, a1->Unk412->GetHeight(v4, v6, v5), a1->Unk120.Unk12);
            }
        }
    }
}
コード例 #3
0
void do_GMEndGame(CPC *a1, char *a2)
{
    int v3; // [sp+24h] [bp-4h]@4
    char *sa; // [sp+34h] [bp+Ch]@4

    if(!a2 || !*a2)
        return;

    sa = AnyOneArg(a2, g_buf, false);
    v3 = atoi(g_buf);
    TrimString(sa);

    if(gserver.Unk41088 != -1)
        return;

    gserver.Unk41088 = 10 * v3;

    if(!*sa)
        return;

    CNetMsg v2;

    MsgrNoticeMsg(v2, -1, -1, -1, -1, sa);

    if(!gserver.Unk452129 && gserver.Unk12 && !gserver.Unk12->Unk361)
    {
        if(gserver.Unk12)
            gserver.Unk12->WriteToOutput(v2);
    }
}
コード例 #4
0
void do_GMKillNPC(CPC *a1, char *a2)
{
    CCharacter *v3; // [sp+20h] [bp-38h]@15
    CCharacter *v4; // [sp+24h] [bp-34h]@16
    int v8; // [sp+44h] [bp-14h]@5
    int v9; // [sp+48h] [bp-10h]@5
    int v10; // [sp+4Ch] [bp-Ch]@5
    int v11; // [sp+50h] [bp-8h]@5
    int v12; // [sp+54h] [bp-4h]@4

    if(a2 && *a2)
    {
        AnyOneArg(a2, g_buf, 0);
        v12 = atoi(g_buf);
        if(v12 > 0)
        {
            v11 = a1->Unk140 - 2;
            v10 = a1->Unk140 + 2;
            v9 = a1->Unk144 - 2;
            v8 = a1->Unk144 + 2;

            CNetMsg v5;

            for(int i = v11; i <= v10; ++i)
            {
                if(i >= 0 && i < a1->Unk412->Unk12)
                {
                    for(int j = v9; j <= v8; ++j)
                    {
                        if(j >= 0 && j < a1->Unk412->Unk16)
                        {
                            v3 = a1->Unk412->Unk28[i][j].Unk0;
                            while(1)
                            {
                                v4 = v3;
                                if(!v3)
                                    break;

                                v3 = v3->Unk404;
                                if(v4->Unk0 == 1 && v12 > GetDistance(a1, v4))
                                {
                                    DamageMsg(v5, a1, v4, 0, -1, v4->Unk78, 4);
                                    v4->Unk412->SendToCell(v5, v4, 0, 4);
                                    v4->Unk76 = 0;

                                    if(v4->Unk76 <= 0)
                                    {
                                        DelAttackList(v4);
                                        a1->Unk412->CharFromCell(v4);
                                        a1->Unk412->DelNPC((CNPC *)v4);
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
コード例 #5
0
void CGMCmdList::run(CPC* pc, const char* arg)
{
    std::string str(arg);
    stokenizer token(str, sep);
    std::vector<std::string> vec;
    vec.assign(token.begin(), token.end());

    if (vec.empty())
        return;

    const char* p = arg;
    char command[512];
    p = AnyOneArg(p, command, true);

    // 존재하는지 검색
    CGMCmd* pGMCmd = find(vec[0]);
    if ( pGMCmd == NULL )
        return;

    // 실행할 수 있는지 검색
    if ( !canRun( pGMCmd, pc ) )
        return;

    GAMELOG << init("GM COMMAND")
            << command << delim << p << delim
            << pc->m_index << delim
            << pc->m_name << delim
            << pc->m_nick << delim
            << end;

    // 실행
    vec.erase(vec.begin());
    pGMCmd->run(pc, p, vec);
}
コード例 #6
0
void do_GMSetRegenSec(CPC *a1, char *a2)
{
    int i; // [sp+Ch] [bp-Ch]@7
    int v3; // [sp+10h] [bp-8h]@4
    int v4; // [sp+14h] [bp-4h]@4
    char *v5; // [sp+24h] [bp+Ch]@4

    if(a2 && *a2)
    {
        v5 = AnyOneArg(a2, g_buf, 0);
        v4 = atoi(g_buf);
        AnyOneArg(v5, g_buf, 0);
        v3 = atoi(g_buf);

        if(v4 > 0 && v3 > 0)
        {
            for(i = 0; i < a1->Unk412->Unk32.Unk8; ++i)
            {
                if(a1->Unk412->Unk32.Unk4[i].Unk0 == v4)
                    a1->Unk412->Unk32.Unk4[i].Unk24 = v3;
            }
        }
    }
}
コード例 #7
0
void do_GMNPCRegen(CPC *a1, char *a2)
{
    int v3; // [sp+14h] [bp-4h]@4

    if(a2 && *a2)
    {
        AnyOneArg(a2, g_buf, 0);
        v3 = atoi(g_buf);

        if(v3 > 0)
        {
            for(int i = 0; i < a1->Unk412->Unk32.Unk8; ++i)
            {
                if(a1->Unk412->Unk32.Unk4[i].Unk0 == v3)
                {
                    if(!a1->Unk412->Unk32.Unk4[i].Unk32)
                        a1->Unk412->Unk32.Unk4[i].Unk24 = 0;
                }
            }
        }
    }
}
コード例 #8
0
void do_GMReboot(CPC *a1, char *a2)
{
    int v4; // [sp+24h] [bp-4h]@4
    char *sa; // [sp+34h] [bp+Ch]@4

    if(a2)
    {
        if(*a2)
        {
            sa = AnyOneArg(a2, g_buf, false);
            v4 = atoi(g_buf);

            TrimString(sa);

            if(gserver.Unk41080 == -1)
            {
                gserver.Unk41080 = 10 * v4;
                if(*sa)
                {
                    CNetMsg v3;

                    SayMsg(v3, 6, 0, "", "", sa);

                    for(int i = 0; i < gserver.Unk24.Unk32768; ++i)
                    {
                        if(gserver.Unk24.Unk0[i])
                        {
                            if(gserver.Unk24.Unk0[i]->Unk768)
                                gserver.Unk24.Unk0[i]->Unk768->WriteToOutput(v3);
                        }
                    }
                }
            }
        }
    }
}
コード例 #9
0
void do_GMItemDrop(CPC *a1, char *a2)
{
    COptionProto *j; // [sp+4Ch] [bp-2Ch]@33
    CItem *v28; // [sp+54h] [bp-24h]@15
    int *v29; // [sp+58h] [bp-20h]@1
    int *v30; // [sp+5Ch] [bp-1Ch]@1
    int v31; // [sp+60h] [bp-18h]@1
    long long v32; // [sp+64h] [bp-14h]@13
    int v33; // [sp+6Ch] [bp-Ch]@10
    int v34; // [sp+70h] [bp-8h]@7
    int v35; // [sp+74h] [bp-4h]@4
    char *v36; // [sp+84h] [bp+Ch]@4
    char *v37; // [sp+84h] [bp+Ch]@7
    char *v38; // [sp+84h] [bp+Ch]@10
    char *v39; // [sp+84h] [bp+Ch]@13
    char *v40; // [sp+84h] [bp+Ch]@18
    char *v41; // [sp+84h] [bp+Ch]@25

    v31 = 0;
    v30 = 0;
    v29 = 0;
    if(a2)
    {
        if(*a2)
        {
            v36 = AnyOneArg(a2, g_buf, 0);
            v35 = atoi(g_buf);
            if(v36)
            {
                if(*v36)
                {
                    v37 = AnyOneArg(v36, g_buf, 0);
                    v34 = atoi(g_buf);
                    if(v37)
                    {
                        if(*v37)
                        {
                            v38 = AnyOneArg(v37, g_buf, 0);
                            v33 = atoi(g_buf);
                            if(v38)
                            {
                                if(*v38)
                                {
                                    v39 = AnyOneArg(v38, g_buf, 0);
                                    v32 = atoll(g_buf);

                                    if(!v32)
                                        v32 = 1;

                                    v28 = a1->Unk412->DropItem(v35, a1, v34, v33, v32, 0);
                                    if(v28)
                                    {
                                        if(v39)
                                        {
                                            if(*v39)
                                            {
                                                v40 = AnyOneArg(v39, g_buf, 0);
                                                v31 = atoi(g_buf);
                                                if(v31 > 0 || v31 <= 5)
                                                {
                                                    v30 = (int *)malloc(4 * v31);
                                                    v29 = (int *)malloc(4 * v31);

                                                    for(int i = 0; i < v31; ++i)
                                                    {
                                                        if(!v40 || !*v40 || (v41 = AnyOneArg(v40, g_buf, 0), v30[i] = atoi(g_buf), !v41) || !*v41)
                                                            return;

                                                        v40 = AnyOneArg(v41, g_buf, 0);
                                                        v29[i] = atoi(g_buf);

                                                        if(v30[i] >= 0 && v30[i] <= 35 && v29[i] > 0 && v29[i] <= 6)
                                                        {
                                                            j = gserver.Unk452236.FindProto(v30[i]);
                                                            if(j)
                                                            {
                                                                v28->Unk68[i].Unk0  = j;
                                                                v28->Unk68[i].Unk4  = v30[i];
                                                                v28->Unk68[i].Unk8  = v29[i];
                                                                v28->Unk68[i].Unk12 = j->Unk8[v29[i]-1];
                                                                v28->Unk68[i].SetDBValue();

                                                                ++v28->Unk168;
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }

                                        CNetMsg v25;

                                        ItemDropMsg(v25, a1, v28);
                                        a1->Unk412->SendToCell(v25, a1, 1, 4);

                                        g_gamelogbuffer.__ls(init("ITEM_LOAD", a1->Unk8));
                                        g_gamelogbuffer.__ls(v28->Unk28);
                                        g_gamelogbuffer.__ls(delim);
                                        g_gamelogbuffer.__ls(v28->Unk44);
                                        g_gamelogbuffer.__ls(delim);
                                        g_gamelogbuffer.__ls(v28->Unk36);
                                        g_gamelogbuffer.__ls(delim);
                                        g_gamelogbuffer.__ls(v28->Unk40);
                                        g_gamelogbuffer.__ls(delim);
                                        g_gamelogbuffer.__ls(v28->Count());
                                        g_gamelogbuffer.__ls(delim);
                                        g_gamelogbuffer.__ls(v28->Unk168);

                                        for(int j_1 = 0; j_1 < v31; j_1++)
                                        {
                                            g_gamelogbuffer.__ls(delim);
                                            g_gamelogbuffer.__ls(v30[j_1]);
                                            g_gamelogbuffer.__ls(delim);
                                            g_gamelogbuffer.__ls(v29[j_1]);
                                        }

                                        g_gamelogbuffer.__ls(end);

                                        if(v30 && v30)
                                            delete v30;

                                        if(v29 && v29)
                                            delete v29;
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
コード例 #10
0
void do_GM(CPC *a1, CNetMsg &a2)
{
    unsigned char dest; // [sp+4Fh] [bp-5h]@1
    int v20, v21;
    char *v22;

    a2.MoveFirst();

    a2.__rs(dest);

    if(dest)
    {
        if(dest == 1)
        {
            *buf = 0;
            a2.__rs(buf);
            *g_buf2 = 0;
            v22 = AnyOneArg(buf, g_buf2, true);

            for(int i = 0; i <= 34; ++i)
            {
                if(!strcmp(g_buf2, gmCmd_567[i]) && a1->Unk732 >= gmLevel_568[i])
                {
                    g_gamelogbuffer.__ls(init("GM COMMAND"));
                    g_gamelogbuffer.__ls(buf);
                    g_gamelogbuffer.__ls(delim);
                    g_gamelogbuffer.__ls(a1->Unk4);
                    g_gamelogbuffer.__ls(delim);
                    g_gamelogbuffer.__ls(a1->Unk8);
                    g_gamelogbuffer.__ls(end);

                    gmFunc_569[i](a1, v22);
                    break;
                }
            }

            if(strcmp(g_buf2, "pkcount"))
            {
                if(!strcmp(g_buf2, "pkpenalty"))
                {
                    AnyOneArg(v22, g_buf2, true);
                    if(strlen(g_buf2))
                    {
                        v21 = atoi(g_buf2);

                        if(v21 < -155)
                            v21 = -155;

                        if(v21 > 155)
                            v21 = 155;

                        a1->Unk1852 = v21;

                        CNetMsg v23;

                        CharStatusMsg(v23, a1, 0);
                        a1->Unk412->SendToCell(v23, a1, 0, 4);
                        a1->Unk473 = 1;
                    }
                }
            }
            else
            {
                AnyOneArg(v22, g_buf2, true);
                if(strlen(g_buf2))
                {
                    v20 = atoi(g_buf2);

                    if(v20 < -110)
                        v20 = -110;

                    if(v20 > 110)
                        v20 = 110;

                    a1->Unk1856 = v20;

                    CNetMsg v23;

                    CharStatusMsg(v23, a1, 0);
                    a1->Unk412->SendToCell(v23, a1, 0, 4);
                    a1->Unk473 = 1;
                }
            }
        }
    }
    else
    {
        CNetMsg v24;

        GMWhoAmIMsg(v24, a1);

        if(a1->Unk768)
            a1->Unk768->WriteToOutput(v24);

        g_gamelogbuffer.__ls(init("GM COMMAND"));
        g_gamelogbuffer.__ls("whoami");
        g_gamelogbuffer.__ls(delim);
        g_gamelogbuffer.__ls(a1->Unk4);
        g_gamelogbuffer.__ls(delim);
        g_gamelogbuffer.__ls(a1->Unk8);
        g_gamelogbuffer.__ls(delim);
        g_gamelogbuffer.__ls(a1->Unk408->Unk0);
        g_gamelogbuffer.__ls(end);
    }
}
コード例 #11
0
void do_GMGoZone(CPC *a1, char *a2)
{
    int v9; // [sp+34h] [bp-14h]@20
    CQuest *v11; // [sp+3Ch] [bp-Ch]@10
    int v12; // [sp+40h] [bp-8h]@7
    uint32_t src; // [sp+44h] [bp-4h]@4
    char *v14; // [sp+54h] [bp+Ch]@4

    *g_buf = 0;
    if(a2)
    {
        if(*a2)
        {
            v14 = AnyOneArg(a2, g_buf, 0);
            src = atoi(g_buf);
            if(v14)
            {
                if(*v14)
                {
                    AnyOneArg(v14, g_buf, 0);
                    v12 = atoi(g_buf);
                    if(src != 6)
                    {
                        if(src != 2 && src != 5)
                        {
                            CNetMsg v7;

                            GoZoneMsg(v7, src, v12, "", 0);
                            do_GoZone(a1, v7);

                            return;
                        }

                        v11 = 0;

                        for(int i = 0; i < gserver.Unk452228.Unk4; ++i)
                        {
                            if(src == 2 && gserver.Unk452228.Unk0[i].Unk4 == 3)
                            {
                                v11 = gserver.Unk452228.Create(gserver.Unk452228.Unk0[i].Unk0);
                                break;
                            }

                            if(src == 5 && gserver.Unk452228.Unk0[i].Unk4 == 4)
                            {
                                v11 = gserver.Unk452228.Create(gserver.Unk452228.Unk0[i].Unk0);
                                break;
                            }
                        }

                        if(v11)
                        {
                            v9 = a1->Unk1900.AddQuest(v11);
                            if(v9 < 0)
                            {
                                delete v11;
                                return;
                            }

                            a1->Unk1900.Unk40[v9] = 1;
                            a1->Unk1900.Unk50[v9] = 0;

                            g_gamelogbuffer.__ls(init("QUEST START"));
                            g_gamelogbuffer.__ls(a1->Unk8);
                            g_gamelogbuffer.__ls(delim);
                            g_gamelogbuffer.__ls(v11->Unk0->Unk0);
                            g_gamelogbuffer.__ls(end);

                            CNetMsg v7;

                            QuestStartMsg(v7, a1->Unk1900.Unk0[v9]);

                            if(a1->Unk768)
                                a1->Unk768->WriteToOutput(v7);

                            CNetMsg v7_1;

                            GoZoneMsg(v7_1, src, v12, "", 0);
                            do_GoZone(a1, v7_1);

                            return;
                        }
                    }
                }
            }
        }
    }
}
コード例 #12
0
void do_GMChatMonitor(CPC *a1, char *a2)
{
    CPC *v2; // [sp+Ch] [bp-1Ch]@25
    int i; // [sp+24h] [bp-4h]@1
    char *v5; // [sp+34h] [bp+Ch]@24

    for(i = 0; i <= 19; ++i)
    {
        if(gserver.Unk41128[i] == a1->Unk768)
        {
            if(!a2 || !*a2)
            {
                gserver.Unk41128[i] = 0;
                CNetMsg v3;

                SayMsg(v3, 6, 0, "", "", "Monitoring Finished!!!");
                if(a1->Unk768)
                    a1->Unk768->WriteToOutput(v3);

                return;
            }
            break;
        }
    }

    if(i == 20)
    {
        for(i = 0; i <= 19; ++i)
        {
            if(!gserver.Unk41128[i])
            {
                gserver.Unk41128[i] = a1->Unk768;
                break;
            }
        }
    }

    if(i == 20)
    {
        CNetMsg v3;

        SayMsg(v3, 6, 0, "", "", "Cannot More Monitor!!!");
        if(a1->Unk768)
            a1->Unk768->WriteToOutput(v3);
    }

    if(a2)
    {
        if(*a2)
        {
            *g_buf = 0;
            v5 = AnyOneArg(a2, g_buf, 0);
            TrimString(g_buf);

            if(strlen(g_buf))
            {
                v2 = gserver.Unk24.Find(g_buf);
                if(v2)
                {
                    *g_buf = 0;
                    AnyOneArg(v5, g_buf, 1);
                    TrimString(g_buf);

                    v2->Unk475 = 1;
                    v2->Unk475 = (strcmp(g_buf, "off")) ? 1 : 0;

                    CNetMsg v3;

                    strcpy(g_buf, "SET CHAT MONITOR: ");
                    strcat(g_buf, v2->Unk8);
                    SayMsg(v3, 6, 0, "", "", g_buf);

                    if(a1->Unk768)
                        a1->Unk768->WriteToOutput(v3);
                }
                else
                {
                    CNetMsg v3;

                    SayMsg(v3, 6, 0, "", "", "Not Found the PC");
                    if(a1->Unk768)
                        a1->Unk768->WriteToOutput(v3);
                }
            }
        }
    }
}
コード例 #13
0
bool CLacarette::Load()
{
	RemoveAll();

	CDBCmd dbQuest;
	CDBCmd dbQuest1;
	dbQuest.Init(&gserver->m_dbdata);
	dbQuest1.Init(&gserver->m_dbdata);
	dbQuest.SetQuery("SELECT * FROM t_lacarette WHERE a_enable=1 ORDER BY a_index");

	if ( !dbQuest.Open() )
		return false;

	if( !dbQuest.MoveFirst() )
		return true;

	if( dbQuest.m_nrecords <= 0)
		return false;

	m_count = dbQuest.m_nrecords;

	CourseInfo * ld = new CourseInfo[m_count];

	int i=0,j=0;
	CLCString temp1(64);
	char buf[64];

	do
	{
		dbQuest.GetRec("a_index",			ld[i].index);
		dbQuest.GetRec("a_useCoinCount",	ld[i].coinUseCnt);

		ld[i].coinIndex  = new int[ld[i].coinUseCnt];
		ld[i].coinDefCnt = new int[ld[i].coinUseCnt];
		ld[i].coinAddCnt = new int[ld[i].coinUseCnt];

		dbQuest.GetRec("a_coinIndex", temp1);
		for(j=0; j<ld[i].coinUseCnt; j++ )
		{
			buf[0] = '\0';
			temp1 = AnyOneArg(temp1, buf);
			if( strlen(buf) < 1 )
				break;
			ld[i].coinIndex[j] = atoi(buf);
		}

		dbQuest.GetRec("a_coinDefCount", temp1);
		for(j=0; j<ld[i].coinUseCnt; j++ )
		{
			buf[0] = '\0';
			temp1 = AnyOneArg(temp1, buf);
			if( strlen(buf) < 1 ) break;
			ld[i].coinDefCnt[j] = atoi(buf);
		}

		dbQuest.GetRec("a_coinAddCount", temp1);
		for(j = 0; j < ld[i].coinUseCnt; j++ )
		{
			buf[0] = '\0';
			temp1 = AnyOneArg(temp1, buf);
			if( strlen(buf) < 1 ) break;
			ld[i].coinAddCnt[j] = atoi(buf);
		}

		// give item info
		ld[i].giveItem = new GiveItemInfo[10];
		for(j = 0; j < LACARETTE_GIVE_ITEM_MAX; j++)
		{
			dbQuest.GetRec( a_giveItem_str[j].c_str(), temp1);

			buf[0] = '\0';
			temp1 = AnyOneArg(temp1, buf);
			if( strlen(buf) < 1 ) break;
			ld[i].giveItem[j].index = atoi(buf);

			buf[0] = '\0';
			temp1 = AnyOneArg(temp1, buf);
			if( strlen(buf) < 1 ) break;
			ld[i].giveItem[j].count = ((LONGLONG)ATOLL(buf));

			buf[0] = '\0';
			temp1 = AnyOneArg(temp1, buf);
			if( strlen(buf) < 1 ) break;
			ld[i].giveItem[j].flag = atoi(buf);

			buf[0] = '\0';
			temp1 = AnyOneArg(temp1, buf);
			if( strlen(buf) < 1 ) break;
			ld[i].giveItem[j].prob = atoi(buf);
		}
		i++;
	}
	while( dbQuest.MoveNext() );

	m_data = ld;
	return true;
}
コード例 #14
0
void do_GMStatPoint(CPC *a1, char *a2)
{
    short v2; // [sp+8h] [bp-20h]@19
    short v3; // [sp+Ah] [bp-1Eh]@16
    short v4; // [sp+Ch] [bp-1Ch]@10
    short v4_2;
    short v6; // [sp+26h] [bp-2h]@4
    char *v7; // [sp+34h] [bp+Ch]@4
    char *v8; // [sp+34h] [bp+Ch]@10
    char *v9; // [sp+34h] [bp+Ch]@13
    char *v10; // [sp+34h] [bp+Ch]@16

    if(a2)
    {
        if(*a2)
        {
            v7 = AnyOneArg(a2, g_buf, 0);
            v6 = atoi(g_buf);

            if(v6 >= 0)
            {
                a1->Unk740 = v6;

                CNetMsg v5;

                StatPointRemainMsg(v5, a1);

                if(a1->Unk768)
                    a1->Unk768->WriteToOutput(v5);

                if(v7 && *v7)
                {
                    v8 = AnyOneArg(v7, g_buf, 0);
                    v4_2 = atoi(g_buf);

                    if(v8 && *v8)
                    {
                        v9 = AnyOneArg(v8, g_buf, 0);
                        v4 = atoi(g_buf);

                        if(v9 && *v9)
                        {
                            v10 = AnyOneArg(v9, g_buf, 0);
                            v3 = atoi(g_buf);

                            if(v10 && *v10)
                            {
                                AnyOneArg(v10, g_buf, 0);
                                v2 = atoi(g_buf);

                                if(v4 >= 0 && v4_2 >= 0 && v3 >= 0 && v2 >= 0)
                                {
                                    a1->Unk742 = v4_2;
                                    a1->Unk744 = v4;
                                    a1->Unk746 = v3;
                                    a1->Unk748 = v2;

                                    a1->InitStat();
                                    a1->CalcStatus(true);
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
コード例 #15
0
ファイル: modify.cpp プロジェクト: mmason930/kinslayer-mud
/*
 * The call that displays the next page.
 */
void show_string(Descriptor *d, char *input)
{
	char buffer[MAX_STRING_LENGTH];
	__int64 diff;

	AnyOneArg(input, buf);

	/*
	 * Q is for quit. :)
	 */
	if (LOWER(*buf) == 'q')
	{
		delete[] (d->showstr_vector);
		d->showstr_count = 0;

		if (d->showstr_head)
		{
			delete[] (d->showstr_head);
			d->showstr_head = NULL;
		}

		return;
	}

	/*
	 * R is for refresh, so back up one page internally so we can display
	 * it again.
	 */
	else if (LOWER(*buf) == 'r')
		d->showstr_page = MAX(0, d->showstr_page - 1);

	/*
	 * B is for back, so back up two pages internally so we can display the
	 * correct page here.
	 */
	else if (LOWER(*buf) == 'b')
		d->showstr_page = MAX(0, d->showstr_page - 2);

	/*
	 * Feature to 'goto' a page.  Just type the number of the page and you
	 * are there! Very handy.
	 */
	else if (isdigit(*buf))
		d->showstr_page = MAX(0, MIN(atoi(buf) - 1, d->showstr_count - 1));

	else if (*buf)
	{
		d->send("Valid commands while paging are RETURN, Q, R, B, or a numeric value.\r\n");
		return;
	}
	/*
	 * If we're displaying the last page, just send it to the character, and
	 * then free up the space we used.
	 */
	if (d->showstr_page + 1 >= d->showstr_count)
	{
		d->sendRaw(d->showstr_vector[d->showstr_page]);

		if (d->showstr_count != 1)
			delete[] (d->showstr_vector);
		else // only 1, not an array
			delete (d->showstr_vector);

		d->showstr_count = 0;

		if (d->showstr_head)
		{
			delete[] (d->showstr_head);
			d->showstr_head = NULL;
		}
	}
	/* Or if we have more to show.... */
	else
	{
		diff = (__int64) d->showstr_vector[d->showstr_page + 1];
		diff -= (__int64) d->showstr_vector[d->showstr_page];

		if (diff >= MAX_STRING_LENGTH)
			diff = MAX_STRING_LENGTH - 1;

		strncpy(buffer, d->showstr_vector[d->showstr_page], diff);
		buffer[diff] = '\0';
		d->sendRaw(buffer);
		++d->showstr_page;
	}
}
コード例 #16
0
void do_GMCountPC(CPC *a1, char *a2)
{
    int src; // [sp+20h] [bp-8h]@1
    int v5; // [sp+24h] [bp-4h]@1

    v5 = 0;
    src = -1;

    if(a2 && *a2)
    {
        AnyOneArg(a2, g_buf, true);
        TrimString(g_buf);

        if(strlen(g_buf))
        {
            if(strcmp(g_buf, "all"))
            {
                v5 = 2;
                src = atoi(g_buf);
            }
            else
            {
                v5 = 1;
            }
        }
        else
        {
            v5 = 0;
        }
    }
    else
    {
        v5 = 0;
    }

    CNetMsg v3;

    if(v5 == 1)
    {
        MsgrPlayerCountReq(v3, -1, -1, a1->Unk4);
    }
    else
    {
        if(v5 > 1)
        {
            if(v5 != 2)
                return;

            MsgrPlayerCountReq(v3, src, -1, a1->Unk4);
        }
        else
        {
            if(v5)
                return;

            MsgrPlayerCountReq(v3, gserver.Unk41004, gserver.Unk41008, a1->Unk4);
        }
    }

    if(!gserver.Unk452129 && gserver.Unk12 && !gserver.Unk12->Unk361)
    {
        if(gserver.Unk12)
            gserver.Unk12->WriteToOutput(v3);
    }
}
コード例 #17
0
void do_GMEcho(CPC *a1, char *a2)
{
    int v3; // [sp+24h] [bp-4h]@5
    char *v4; // [sp+34h] [bp+Ch]@4
    char *v5; // [sp+34h] [bp+Ch]@13

    *g_buf = 0;
    if(a2 && *a2)
    {
        v4 = AnyOneArg(a2, g_buf, true);
        if(strcmp(g_buf, "zone"))
        {
            if(strcmp(g_buf, "server"))
            {
                if(strcmp(g_buf, "all"))
                {
                    if(strcmp(g_buf, "subserver"))
                        return;

                    v3 = 3;
                }
                else
                {
                    v3 = 2;
                }
            }
            else
            {
                v3 = 1;
            }
        }
        else
        {
            v3 = 0;
        }

        v5 = SkipSpaces(v4);

        if(v5 && *v5)
        {
            CNetMsg v2;

            if(v3 == 1)
            {
                MsgrNoticeMsg(v2, -1, gserver.Unk41004, -1, -1, v5);
            }
            else
            {
                if(v3 > 1)
                {
                    if(v3 == 2)
                    {
                        MsgrNoticeMsg(v2, -1, -1, -1, -1, v5);
                    }
                    else
                    {
                        if(v3 == 3)
                            MsgrNoticeMsg(v2, -1, gserver.Unk41004, gserver.Unk41008, -1, v5);
                    }
                }
                else
                {
                    if(!v3)
                        MsgrNoticeMsg(v2, -1, gserver.Unk41004, gserver.Unk41008, a1->Unk408->Unk0, v5);
                }
            }

            if(!gserver.Unk452129 && gserver.Unk12 && !gserver.Unk12->Unk361)
            {
                if(gserver.Unk12)
                    gserver.Unk12->WriteToOutput(v2);
            }
        }
    }
}
コード例 #18
0
bool CDropManager::loadDropData(MYSQL * _dataDB)
{
	CDBCmd cmdHead;
	cmdHead.Init(_dataDB);

	std::string sql = "SELECT * FROM t_drop_item_head ORDER BY a_drop_idx";

	cmdHead.SetQuery(sql);

	if( !cmdHead.Open() || !cmdHead.MoveFirst() )
	{
		GAMELOG << init("EVENT_AUTOMATION_WARN") << "NO EXIST TABLE DROP ITEM HEAD" << end;
		return false;\
	}

	if( cmdHead.m_nrecords < 1 )
	{
		GAMELOG << init("EVENT_AUTOMATION_WARN") << "EMPTY TABLE DROP ITEM HEAD" << end;
		return false;
	}

	CDBCmd cmdData;
	cmdData.Init(_dataDB);

	int dropIndex=0, dropType=0, levelmini=0, levelMaxi=0, dropProb=0, probPerLevel=0, party=1, boss=1;
	CLCString npclist;
	CLCString levelsection(256);
	do
	{
		if(    !cmdHead.GetRec("a_drop_idx",		dropIndex)
				|| !cmdHead.GetRec("a_drop_type",		dropType)
				|| !cmdHead.GetRec("a_level_mini",		levelmini)
				|| !cmdHead.GetRec("a_level_maxi",		levelMaxi)
				|| !cmdHead.GetRec("a_prob",			dropProb)
				|| !cmdHead.GetRec("a_prob_level",		probPerLevel)
				|| !cmdHead.GetRec("a_npc_type_party",	party)
				|| !cmdHead.GetRec("a_npc_type_boss",	boss)
				|| !cmdHead.GetRec("a_npc",				npclist)
				|| !cmdHead.GetRec("a_level_section",	levelsection)
		  )
		{
			GAMELOG << init("EVENT_AUTOMATION_WARN") << "NOT MATCHING FIELD IN TABLE DROP ITEM HEAD" << end;
			return false;
		}

		std::string select_drop_item_data_sql = boost::str(boost::format("SELECT * FROM t_drop_item_data WHERE a_drop_idx=%d ") % dropIndex);
		cmdData.SetQuery( select_drop_item_data_sql );

		if( !cmdData.Open()  )
		{
			GAMELOG << init("EVENT_AUTOMATION_WARN") << "NO EXIST TABLE DROP ITEM DATA" << end;
			return false;
		}

		if( !cmdData.MoveFirst() )
			continue;

		if( cmdData.m_nrecords < 1 )
			continue;

		CDropInfo dData(dropIndex, dropType, levelmini, levelMaxi, dropProb, probPerLevel, party, boss);

		const char* pArg = npclist;
		char buf[8]= {0,};
		int npcIndex=0;
		while (*pArg)
		{
			pArg = AnyOneArg(pArg, buf);
			npcIndex = atoi(buf);
			if( npcIndex > 0 )
				dData.addNpc( npcIndex);
		}

		pArg = levelsection;
		int lvlstart, lvlend, lvlprob;
		while (*pArg)
		{
			pArg = AnyOneArg(pArg, buf);
			lvlstart	= atoi(buf);
			pArg = AnyOneArg(pArg, buf);
			lvlend		= atoi(buf);
			pArg = AnyOneArg(pArg, buf);
			lvlprob		= atoi(buf);

			if( lvlprob > 0 )
			{
				CProbByLevelSection ls(lvlstart, lvlend, lvlprob);
				dData.addLevelSection( ls );
			}
		}

		int index=0, plus=0, flag=0, prob=0, jobFlag =0;
		LONGLONG count=0;

		do
		{
			if(	   !cmdData.GetRec("a_item_idx",	index)
					|| !cmdData.GetRec("a_plus",		plus)
					|| !cmdData.GetRec("a_flag",		flag)
					|| !cmdData.GetRec("a_count",		count)
					|| !cmdData.GetRec("a_prob",		prob)
					|| !cmdData.GetRec("a_job_flag",	jobFlag)
			  )
			{
				GAMELOG << init("EVENT_AUTOMATION_WARN") << "NOT MATCHING FIELD IN TABLE DROP ITEM DATA" << end;
				return false;
			}

			CDropItemData diData(index, plus, flag, count, prob, jobFlag );
			dData.addItem( diData );
		}
		while( cmdData.MoveNext() );

		m_dataList.insert( std::map<int,CDropInfo>::value_type( dropIndex, dData ) );
	}
	while( cmdHead.MoveNext() );

	return true;
}