Пример #1
0
struct tab* tab_init(void)
{
    struct tab * addr;

    /* 分配存储空间 */
    addr = (struct tab *)malloc(sizeof(struct tab));

    if(addr == NULL) {
        EGUI_PRINT_SYS_ERROR("fail to malloc");
        return NULL;
    }

    if(NULL == (addr = widget_init_common(WIDGET_POINTER(addr), 0))) {
        return NULL;
    }
    /* struct tab 的成员 */
    addr->name = "struct tab";

    /* 用全局样式对象初始化tab样式 */
    tab_init_with_default_style(addr);

    addr->border_size = 0;

    addr->header = tab_header_init();
    addr->header->parent_tab = addr;
    object_attach_child(OBJECT_POINTER(addr),
            OBJECT_POINTER(addr->header));

    return addr;
}
Пример #2
0
si_t save_as_button_callback(void* btn, void* msg)
{
    union message* m = (union message*)msg;
	struct button* b = NULL;
	switch(m->base.type)
	{
	case MESSAGE_TYPE_MOUSE_SINGLE_CLICK:
		if(NULL == save_window)
		{
			save_window = window_init("save window");
            /* 申请失败 */
            if(NULL == main_window)
            {
				EGUI_PRINT_ERROR("failed to init save window");
				application_exit();
                return -1;
            }
			window_set_bounds(save_window, main_window->area.x + 30, main_window->area.y + 30, 300, 60);
			window_set_color(save_window, NULL, &barely_blue);

			save_text_line = text_line_init(FILE_MAX, 0);
			if(NULL == save_text_line)
			{
				EGUI_PRINT_ERROR("failed to init save_text_line on save window");
				application_exit();
				return -1;
			}
			text_line_set_bounds(save_text_line, 5, 5, 230, 50);
			text_line_set_placeholder(save_text_line, "input file name");
			text_line_set_color(save_text_line, &dark_blue, NULL, &light_green);

			b = button_init("ok");
			if(NULL == b)
			{
				EGUI_PRINT_ERROR("failed to init ok button on save window");
				application_exit();
				return -1;
			}
			button_set_bounds(b, 240, 10, 50, 40);
			button_set_color(b, &dark_blue, &light_green);
			button_set_font(b, FONT_MATRIX_12);
			b->callback = save_window_ok_button_callback;

			object_attach_child(OBJECT_POINTER(save_window), OBJECT_POINTER(b));
			object_attach_child(OBJECT_POINTER(save_window), OBJECT_POINTER(save_text_line));
			application_add_window(NULL, save_window);
			break;
		}
		else
		{
			EGUI_PRINT_ERROR("save window already open!");
		}
	default:
		button_default_callback(btn, msg);
	}
	return 0;
}
Пример #3
0
int main()
{
    si_t video_access_mode = VIDEO_ACCESS_MODE_BUFFER;
	si_t app_type = APPLICATION_TYPE_NORMAL;
    struct window * w;
    struct scroll_bar* s;
    struct label* l;
    char show[25];

    /* 初始化用户应用程序 */
    application_init(video_access_mode, app_type, "scroll_bar");

    /* 申请窗口 */
    w = window_init("window with scroll_bar");
    /* 申请失败 */
    if(w == NULL)
    {
        application_exit();
        return -1;
    }
	window_set_bounds(w, 300, 100, 448, 200);

    s = scroll_bar_init(1, 400, 20);
    /* 申请失败 */
    if(s == NULL)
    {
        application_exit();
        return -1;
    }
	scroll_bar_set_bounds(s, 428, 0, 20, 200);
 
    l = label_init(show);
    /* 申请失败 */
    if(l == NULL)
    {
        application_exit();
        return -1;
    }
	label_set_bounds(l, 10, 40, 400, 20);
    sprintf(show, "not started");

    scroll_bar_register_move_handler(s, WIDGET_POINTER(l), SCROLL_BAR_EVENT_ALL, label_handler);
   
    object_attach_child(OBJECT_POINTER(w), OBJECT_POINTER(s));
    object_attach_child(OBJECT_POINTER(w), OBJECT_POINTER(l));

    /* 添加顶层窗口 */
    application_add_window(NULL, w);
    /* 设置主窗口 */
    application_set_main_window(w);

    /* 运行 */
    application_exec();

    return 0;
}
Пример #4
0
int MygEventMonsterItemDrop(BYTE *b_MonsterDataAddr,BYTE *a_gObjAddr)
	// 2Class = 1, 17, 33, 49, 65
	// 3Class = 2, 18, 34, 50, 66
{
	PBYTE a_aIndex = 0;
	PBYTE b_mIndex = 0;

	a_aIndex = (PBYTE)a_gObjAddr;
	b_mIndex = (PBYTE)b_MonsterDataAddr;

	WORD mIndex = 0;
	WORD aIndex = 0;
	int vActive = GetPrivateProfileInt("DropZen","Active",1,".\\Config\\DropZen.cfg");
	int vDropZenPlus = GetPrivateProfileInt("DropZen","DropZenPlus",1,".\\Config\\DropZen.cfg");
	int vZenMoney = GetPrivateProfileInt("DropZen","ZenMoney",1,".\\Config\\DropZen.cfg");
	int vZenDrop = GetPrivateProfileInt("DropZen","ZenDrop",1,".\\Config\\DropZen.cfg");

	memcpy(&mIndex, b_mIndex+0x00,sizeof(WORD));
	memcpy(&aIndex, a_aIndex+0x00,sizeof(WORD));
	int Randomer = rand()%100+1;
	OBJECTSTRUCT *mObj = (OBJECTSTRUCT*) OBJECT_POINTER (mIndex);
	OBJECTSTRUCT *pObj = (OBJECTSTRUCT*) OBJECT_POINTER (aIndex);
	int MoneyMob = mObj->Money/Randomer;
	int Default = gEventMonsterItemDrop(b_MonsterDataAddr, a_gObjAddr);


	int StateMoney = vZenMoney;

	if (vActive == 1)
	{
		/*if (vDropZenPlus == 1)
		{
        if(Randomer < vZenDrop)
				{
		mObj->Money += StateMoney;
		return Default;
		}
		else
		{
		return Default;
		}
		}
		else
		{
		mObj->Money -= StateMoney;
		return Default;
		}*/

		mObj->Money =MoneyMob;
	}
	else
	{
		return Default;
	}
	return 1;
}
Пример #5
0
void GCDamageSend(int aIndex,int TargetIndex,int AttackDamage,int MSBFlag,int MSBDamage,int iShieldDamage)
{
    PMSG_ATTACKRESULT pResult;

#if (IS_PROTOCOL_JPN == 0)
    PHeadSetB((LPBYTE)&pResult,0x11,sizeof(pResult));	// (1.03P 1.03.16 main)
#else
    PHeadSetB((LPBYTE)&pResult,0xDC,sizeof(pResult));	// (1.03K 1.03.11 main)
#endif

    pResult.NumberH = SET_NUMBERH(TargetIndex);
    pResult.NumberL = SET_NUMBERL(TargetIndex);
    pResult.DamageH = SET_NUMBERH(AttackDamage);
    pResult.DamageL = SET_NUMBERL(AttackDamage);

    pResult.btShieldDamageH = SET_NUMBERH(iShieldDamage);
    pResult.btShieldDamageL = SET_NUMBERL(iShieldDamage);

    if(MSBFlag != false)
    {
        pResult.NumberH &= 0x7F;
        pResult.NumberH |= 0x80;
    }

    pResult.DamageType = MSBDamage;

    OBJECTSTRUCT * gObj = (OBJECTSTRUCT*)OBJECT_POINTER(aIndex);
    OBJECTSTRUCT * gTarg = (OBJECTSTRUCT*)OBJECT_POINTER(TargetIndex);

    pResult.Life = gTarg->Life;
    pResult.MaxLife = gTarg->MaxLife + gTarg->AddLife;

    pResult.X = gTarg->X;
    pResult.Y = gTarg->Y;

    if(gTarg->Type == OBJECT_MONSTER)
    {
        pResult.Life = gTarg->Life;
        pResult.MaxLife = gTarg->MaxLife + gTarg->AddLife;
    }

    if(gTarg->Type == OBJECT_USER)
    {
        DataSend(TargetIndex, (LPBYTE)&pResult, pResult.h.size);
    }

    if(gObj->Type == OBJECT_USER)
    {
        DataSend(aIndex, (LPBYTE)&pResult, pResult.h.size);
    }

    lpGCDamageSend(aIndex, TargetIndex, AttackDamage, MSBFlag, MSBDamage, iShieldDamage);
}
Пример #6
0
si_t pop_window()
{
    switch(save_or_rename_flag)
    {
        case 0:
            save_window = window_init("save_directory_window");
            break;
        case 1:
            save_window = window_init("save_file_window");
            break;
        case 2:
            save_window = window_init("rename_window");
            break;
        default:
            break;
     }
    if(NULL == save_window)
    {
        //EGUI_PRINT_ERROR("failed to init save window");
		application_exit();
        return -1;
    }
    window_set_bounds(save_window,200, 200, 300, 60);
    window_set_color(save_window, NULL, &ground_purple);
    save_text_line = text_line_init(100, 0);
    if(NULL == save_text_line)
    {
        //EGUI_PRINT_ERROR("failed to init save_text_line on save window");
        application_exit();
        return -1;
    }
    text_line_set_bounds(save_text_line, 5, 5, 230, 50);
    text_line_set_placeholder(save_text_line, "input file name");
    text_line_set_color(save_text_line, &heavy_blue, NULL, &heavy_blue );
    save_button = button_init("OK");
    if(NULL == save_button)
	{
	    //EGUI_PRINT_ERROR("failed to init ok button on save window");
        application_exit();
        return -1;
	}
    button_set_bounds(save_button, 240, 10, 50, 40);
    button_set_color(save_button, &ground_purple, &heavy_blue );
    button_set_font(save_button, FONT_MATRIX_12);
	save_button->callback = rename_window_ok_button_callback;
    object_attach_child(OBJECT_POINTER(save_window), OBJECT_POINTER(save_button));
    object_attach_child(OBJECT_POINTER(save_window), OBJECT_POINTER(save_text_line));
    application_add_window(Desktop_w, save_window);
    return 0;

}
Пример #7
0
/*
    测试 eicon
*/
int main()
{
    si_t video_access_mode = VIDEO_ACCESS_MODE_BUFFER;
    ewindow * w;
    eicon * ic;

    /* 初始化用户应用程序 */
    application_init(video_access_mode, "eicon");

    /* 申请窗口 */
    w = window_init(1);
    /* 申请失败 */
    if(w == NULL)
    {
        application_exit();
        return -1;
    }
	window_set_bounds(w,300,100,500,200);
    w->title = "window with eicon";
    w->minimize_enable = 1;
    w->maximize_enable = 1;
    w->callback = window_default_callback;

    /* 申请按钮 */
    ic = icon_init(2);
    /* 申请失败 */
    if(ic == NULL)
    {
        application_exit();
        return -1;
    }
    icon_set_bounds(ic ,50,50,100,120);
	icon_set_text(ic,"ehello");
	icon_set_img_path(ic,"/home/orange/Egui2.0/img/2.bmp");
	icon_set_is_text_visiable(ic ,1);
    ic->callback = icon_default_callback;

    /* 将按钮添加到窗口 */
    object_attach_child(OBJECT_POINTER(w), OBJECT_POINTER(ic));

	/* 添加顶层窗口 */
    application_add_window(NULL, w);
    /* 设置主窗口 */
    application_set_main_window(w);

    /* 运行 */
    application_exec();

    return 0;
}
Пример #8
0
static si_t
handle_window_deactivate
(union message * msg)
{
    struct widget* w;

    if(global_application.focus->descriptor == msg->base.window_descriptor)
    {
        global_application.focus = NULL;
    }

    w = application_widgets_for_each_increament(do_find_window, msg);
    if(w != NULL)
    {
        if(w->callback != NULL)
            w->callback(w, msg);

        dispatch_msg_to_subchilds(OBJECT_POINTER(w), MESSAGE_TYPE_WIDGET_REPAINT);

        /**
         * set every focus widget lose focus
         **/
        application_update_keybd_focus(NULL);
    }

    return 0;
}
Пример #9
0
//========================================================================================================================
void CloseClientHook(int aIndex)
{	
	if ( aIndex >= OBJECT_MIN && aIndex < OBJECT_MAX )
    {
		OBJECTSTRUCT *gObj = (OBJECTSTRUCT*)OBJECT_POINTER(aIndex);

		if ( aIndex < 0 || aIndex > OBJECT_MAX-1 )
			return;

		if(gObj->Connected == 3)
		{
			if(gObj->Life <= 0)
			{
				//Log.outError("ResponErrorCloseClientHook");
				return;
			}
		}

		if(OfflineShop[aIndex].IsOffTrade != 0)
			return; 

		

		if ( gObj->Connected == PLAYER_EMPTY )
			return;

		if ( gObj->m_socket != INVALID_SOCKET )
		{
			closesocket(gObj->m_socket );
			gObj->m_socket = INVALID_SOCKET;
		}
	}
}
Пример #10
0
void GCKillPlayerExpSendHook(int aIndex, int TargetIndex, int exp, int AttackDamage, BOOL MSBFlag)
{   
	// -----
	// -----
     OBJECTSTRUCT * lpObj = (OBJECTSTRUCT*) OBJECT_POINTER (aIndex);
     unsigned int pNewExperience = exp;
     unsigned int pBonusExp = 0;
     unsigned int pNewExperenceML = exp;
     unsigned int pBonusExpML = 0;
     // ----
     if(lpObj->pInventory[8].m_Type == 0x1A50) // Panda
     {          
          pBonusExp               = ((exp * Config.Panda.PetPandaExpirence) / 100);
          pBonusExpML               = ((exp * Config.Panda.PetPandaMLExpirence) / 100);
          // ----
          pNewExperience          += pBonusExp;
          pNewExperenceML          += pBonusExpML;
          // ----
          lpObj->Experience     += pBonusExp;
          lpObj->MLExp          += pBonusExpML;
     }

	if(lpObj->pInventory[10].m_Type == 0x1A4C || lpObj->pInventory[11].m_Type == 0x1A4C) // Panda Ring
     {          
          pBonusExp               = ((exp * Config.Panda.PandaRingExpirence) / 100);
          pBonusExpML               = ((exp * Config.Panda.PandaRingMLExpirence) / 100);
          // ----
          pNewExperience          += pBonusExp;
          pNewExperenceML          += pBonusExpML;
          // ----
          lpObj->Experience     += pBonusExp;
          lpObj->MLExp          += pBonusExpML;
     }
     GCKillPlayerExpSend(aIndex , TargetIndex , pNewExperience , AttackDamage , MSBFlag);
}
Пример #11
0
// -----------------------------------------------------------------------------------------------------------------------
//int VIPEXP = Experience + VIPExp;
// -----------------------------------------------------------------------------------------------------------------------
void ExpSystem(int aIndex, int TargetIndex, int Exp, int AttackDamage, BOOL MSBFlag)
{
    if (ExpSystemEnabled = 1)
    {
        OBJECTSTRUCT *gObj = (OBJECTSTRUCT*) OBJECT_POINTER (aIndex);
        unsigned int pNewExperience = Exp;
        unsigned int pBonusExp = 0;
        int ExpRes = 0;
        int ExpDel = (ExpSystempDel+1);
        int ExpS;
        if (SQL.ResetS > 30)
        {
            ExpS = 200;
        }
        if ((SQL.ResetS < 30)||(SQL.ResetS = 30))
        {
            ExpS = 100;
        }
        SQL.GetResetCharacter(gObj->Name);
        ExpRes = (ExpDel-SQL.ResetS);
        pBonusExp = ((Exp*ExpRes)/100);
        pNewExperience += pBonusExp;
        gObj->Experience += pBonusExp;
        GCKillPlayerExpSend(aIndex,TargetIndex,pNewExperience,AttackDamage,MSBFlag);
    }
    else
    {
        float * EXPERIENCE = (float *)(CGAddExperience);
        (*EXPERIENCE) = NormEXP;
    }
}
Пример #12
0
void CUserEx::Connect(int aIndex)
{
	if(!OBJMAX_RANGE(aIndex)) return;
	if(!gObjIsConnected(aIndex)) return;
			
	//LPOBJ * lpObj = (LPOBJ*)POBJ(aIndex);
	OBJECTSTRUCT * lpObj = (OBJECTSTRUCT*)OBJECT_POINTER(aIndex);
	//Clear External Objectstructure
	LPOBJEX * lpObjEx = &gObjEx[POBJEX(aIndex)];
	lpObjEx->Clear();

	//LogAddC(LOG::BLACK,"[UserEx](%s)(%s) Player Connect (%d,%d)",lpObj->AccountID,lpObj->Name,lpObj->Index,POBJEX(aIndex));

	//GCServerMsgStringSendEx(aIndex,1,"Server powered by XtremeCoderz");
	//GCServerMsgStringSendEx(aIndex,0,CommonServer.ConnectMessage);
	//Send Player enter In Game
	//Msg.Send(POST::WHISHPER,-1,Msg.Get(CMSG::ETC,0),lpObj->Name);

	//AutoAdd Helper Extension
	/*if(CommonServer.AddHelperExtensionBuff == true)
	{
		gObjAddBuffEffect(lpObj,BUFFTYPE_MACRO_PAID_EXTENSION,0,0,0,0,((3600 * 24) * 30));
	}*/
#if(COMPILE_CASHSHOP==1)

#endif

	//Request UserEx Data
	//this->RequestExData(aIndex);

	//Request VIP
	//VIPSystem.RequestVIP(aIndex);
}
Пример #13
0
void save_depth(struct node_t *tree)
{
    struct node_t *it;
    for (it = object_tree_l_most_node(tree->obj.parent); it;
         it = object_tree_iterator_increment(tree->obj.parent,
                                             OBJECT_POINTER(it))) {
        struct node_t *par =
            (struct node_t *)object_parent(OBJECT_POINTER(it));
        if (par) {
            it->data.depth = par->data.depth + 1;
        }
        else {
            it->data.depth = 0;
        }
    }
}
Пример #14
0
void CVipSystem::ApplyVip(int aIndex)
{
	OBJECTSTRUCT *pObj = (OBJECTSTRUCT*)OBJECT_POINTER(aIndex);
	if(Vip[pObj[aIndex].m_Index - OBJECT_MIN] == 0)
	{
		char lvlmsg[100];
		sprintf(lvlmsg,"[Free] Welcome back, [ %s ].", pObj->AccountID);
		GCServerMsgStringSend(lvlmsg,aIndex,1);
	}
	if(Vip[pObj[aIndex].m_Index - OBJECT_MIN] == 1)
	{
		pObj[aIndex].m_wItemDropRate += this->m_PlatinumDrop;
		char lvlmsg[100];
		sprintf(lvlmsg,"[Bronze VIP] Welcome back, [ %s ].", pObj->AccountID);
		GCServerMsgStringSend(lvlmsg,aIndex,1);
	}
	else if(Vip[pObj[aIndex].m_Index - OBJECT_MIN] == 2)
	{
		pObj[aIndex].m_wItemDropRate += this->m_PlatinumDrop;
		char lvlmsg[100];
		sprintf(lvlmsg,"[Platinum VIP] Welcome back, [ %s ].", pObj->AccountID);
		GCServerMsgStringSend(lvlmsg,aIndex,1);
	}
	else if(Vip[pObj[aIndex].m_Index - OBJECT_MIN] == 3)
	{
		pObj[aIndex].m_wItemDropRate += this->m_GoldDrop;
		char lvlmsg[100];
		sprintf(lvlmsg,"[Gold VIP] Welcome back, [ %s ].", pObj->AccountID);
		GCServerMsgStringSend(lvlmsg,aIndex,1);
	}
}
Пример #15
0
void GCEquipmentSendHook(int aIndex)
{							
	OBJECTSTRUCT * gObj = (OBJECTSTRUCT*)OBJECT_POINTER(aIndex);

	GCEquipmentSend(aIndex);
	
	//Fix Double Pets on trade cancel/ok/success
	if(gObj->pInventory[8].m_Type != SLOT_EMPTY)
	{
		if(gObj->pInventory[8].m_Type == 0x1A50 || gObj->pInventory[8].m_Type == 0x1A7B)
		{	
			CItem OldItem;
			OldItem = gObj->pInventory[8];
			gObj->pInventory[8].m_Type = -1;

			gObjMakePreviewCharSet(aIndex);
			GCItemListSend(aIndex);
			gObjViewportListProtocolCreate(gObj);

			gObj->pInventory[8] = OldItem;

			gObjMakePreviewCharSet(aIndex);
			GCItemListSend(aIndex);
			gObjViewportListProtocolCreate(gObj);
		}
	}
	
	if(gObj->pInventory[RING_01].m_Type == 0x1A7A 
		|| gObj->pInventory[RING_02].m_Type == 0x1A7A) //Skeleton Ring
		_beginthread( TradeSystem__Cancel, 0, NULL  );
}
Пример #16
0
int CPlayer::RemoveMoney(int Count)
{	
	OBJECTSTRUCT *gObj = (OBJECTSTRUCT*)OBJECT_POINTER(this->aIndex);
	gObj->Money -= Count;
	GCMoneySend(aIndex,gObj->Money);
	return 0;
}
Пример #17
0
//========================================================================================================================
void CloseClient2Hook(_PER_SOCKET_CONTEXT * lpPerSocketContext, int result)
{
    int index = -1;
    index = lpPerSocketContext->nIndex ;    

    if ( index >= OBJECT_MIN && index < OBJECT_MAX )
    {	
		OBJECTSTRUCT *gObj = (OBJECTSTRUCT*) OBJECT_POINTER(index);

		if(gObj->Connected == 3)
		{
			if(gObj->Life <= 0)
			{
				//Log.outError("ResponErrorCloseClientHook");
				return;
			}
		}

        if(OfflineShop[index].IsOffTrade != 0)
            return;

        if ( gObj->m_socket != INVALID_SOCKET )
        {
            if (closesocket(gObj->m_socket) == -1 )
            {
                if ( WSAGetLastError() != WSAENOTSOCK )
                    return;
            }
            gObj->m_socket = INVALID_SOCKET;

	
        }
        gObjDel(index);
    }
}
Пример #18
0
si_t shortcut_delete(struct shortcut* sh_ptr){
	int number = vector_find(&sh_desktop_vector, sh_ptr, link_file_cmp);
	if(number>=0){
		object_remove(OBJECT_POINTER(sh_ptr));
		//object_delete(OBJECT_POINTER(sh_ptr),_widget_destructor);
		//vector_erase(&sh_desktop_vector,number);
		//位置清除
		flag_pptr[sh_ptr->position_x][sh_ptr->position_y]=0;
		app_number--;
		
		pid_t pid;
		if((pid = fork()) == 0)
    	{
    		if(strcmp(sh_ptr->app_name,"file_browser")==0 && sh_ptr->is_real==1){
        		//execl("/bin/rm", "rm",sh_ptr->link_file_path, NULL);
				//exit(0);
				//delete_file(sh_ptr->link_file_path);
				//rmdir(sh_ptr->link_file_path);
				//exit(0);
			}
        	else if(sh_ptr->is_real==1)
           	 	execl("/bin/rm", "rm", sh_ptr->link_file_path, NULL);
        }
		
	}
	return 0;
}
Пример #19
0
/*void OffTradeLogin(int aIndex,LPBYTE aRecv)
{
	PMSG_IDPASS *lpMsg = (PMSG_IDPASS*)aRecv;

	char AccountID[11];
	AccountID[10] = 0;
	memcpy(AccountID,lpMsg->Id,sizeof(lpMsg->Id));
	BuxConvert(AccountID,10);

	for(int i = OBJECT_MIN; i<OBJECT_MAX;i++)
	{
		OBJECTSTRUCT *lpObj = (OBJECTSTRUCT*)OBJECT_POINTER(i);

		if(lpObj->Connected == 3)
		{
			if(!strcmp(AccountID,lpObj->AccountID))
			{
				if(OfflineShop[i].IsOffTrade == 1)
				{
					GJPUserClose(lpObj->AccountID);
					g_Console.ConsoleOutput(4,"[OFFTRADE][%s][%s] Close Offline Shop",lpObj->AccountID,lpObj->Name);
					//LogAdder ("OFFTRADE","Close Offline Shop",i);
					gObjDel(i);
					OfflineShop[i].IsOffTrade = 0;
					//SQL.OffTradeOff(aIndex);
				
				}
			}
		}


	
	}
}*/
void OffTradeLogin(int aIndex,LPBYTE aRecv)
{
	PMSG_IDPASS *lpMsg = (PMSG_IDPASS*)aRecv;

	char AccountID[11];
	AccountID[10] = 0;
	memcpy(AccountID,lpMsg->Id,sizeof(lpMsg->Id));
	BuxConvert(AccountID,10);

	for(int i = OBJECT_MIN; i<OBJECT_MAX;i++)
	{
		OBJECTSTRUCT *lpObj = (OBJECTSTRUCT*)OBJECT_POINTER(i);

		if(lpObj->Connected == 3)
		{
			if(!strcmp(AccountID,lpObj->AccountID))
			{
				if(OfflineShop[i].IsOffTrade == 1)
				{
					GJPUserClose(lpObj->AccountID);
					g_Console.ConsoleOutput(4,"[OFFTRADE][%s][%s] Close Offline Shop",lpObj->AccountID,lpObj->Name);
					//LogAdder ("OFFTRADE","Close Offline Shop",i);
					gObjDel(i);
					OfflineShop[i].IsOffTrade = 0;
					//SQL.OffTradeOff(aIndex);
				}
			}
		}
	}
}
Пример #20
0
si_t panel_default_mouse_release(struct panel* pnl , union message * msg)
{
/*	panel_event_in_which_widget(pnl, msg);*/
	si_t flag = 0;
	struct widget * wgt;

	struct rectangle area;

	struct object * tree, *node ;

	tree = OBJECT_POINTER(pnl);
	node = tree->rchild;
	while(node != NULL)
	{
		widget_absolute_area(WIDGET_POINTER(node), &area);
		if(point_in_area(&(msg->mouse.cursor_position), &area))
		{
			wgt = (struct widget*)node;
			wgt->callback(wgt, msg);
			flag = 1;
			break;
		}
		node = object_tree_iterator_decrement(tree,node);

	}
	if(flag == 0)
	{
		/* 
		 * panel doesn't have children.
		 * so ,do nothing
		 * */
	}
	return 1;
}
Пример #21
0
bool cChat::SetPKCommand(LPOBJ gObj, char *Msg, int Index)
{								 			
	if(CheckCommand(gObj, Configs.Commands.IsSetPK, GmSystem.cSetPK, 0, 0, 0, Index, "SetPK", "[Name] /setpk <pklvl>", Msg))
		return true;

	int SetLevel;
	sscanf(Msg,"%d", &SetLevel);		

	if(SetLevel < 0 || SetLevel > 100)
	{
		TNotice.MessageLog(1,  gObj, "[SetPK] PK lvl can't be less than 0 and more than 100!");
		return true;
	}			 

	OBJECTSTRUCT *tObj = (OBJECTSTRUCT*)OBJECT_POINTER(Index);

	tObj->m_PK_Level = SetLevel;
	if(SetLevel >= 3)
		tObj->m_PK_Count = SetLevel - 3;
	GCPkLevelSend(tObj->m_Index,SetLevel);	 

	if (gObj == tObj)
		TNotice.MessageLog(1,tObj, "[SetPK] Your pk was changed to %d.", SetLevel);
	else
	{
		TNotice.MessageLog(1,gObj, "[SetPK] You successfully changed %s pk to %d.", tObj->Name, SetLevel);
		TNotice.MessageLog(1,tObj, "[SetPK] Your pk was changed to %d by %s.", SetLevel, gObj->Name);
	}
	return true;
}
Пример #22
0
//bool cChat::GuildPost(LPOBJ gObj, char *Msg)
//{ 
//	int aIndex = User.GetPlayerIndex(gObj->Name);
//
//	if(gObj->GuildStatus == 128 || gObj ->GuildStatus == 64 || gObj ->GuildStatus == 32)
//		GDGuildNoticeSave(gObj->GuildName, Msg);
//	else
//		TNotice.SendNotice(aIndex,1,"You aren't guild master or assistant");	
//	return true;
//}
//
//bool cChat::Core(LPOBJ gObj, char *Msg)
//{ 
//	MessageLog(1,  gObj,"IA Julia 1.1.%d.%d, Compiled %s %s",dBuild, dCommit, __DATE__, __TIME__);	
//	return true;
//}
//
bool cChat::SetZenCommand(LPOBJ gObj, char* Msg, int Index)
{
	if(CheckCommand(gObj, Configs.Commands.IsSetZen, GmSystem.cSetZen, 0, 0, 1, Index, "SetZen", "[Name] /setzen <Zen>", Msg))
		return true;

	DWORD Zen = 0;

	sscanf(Msg, "%d", &Zen);

	if(Zen <= 0 || Zen > 2000000000)
	{
		TNotice.MessageLog(1,  gObj, "[SetZen] Zen can't be less than 1 and more than 2000000000!");
		return true;
	}	

	OBJECTSTRUCT *tObj = (OBJECTSTRUCT*)OBJECT_POINTER(Index);

	tObj->Money = Zen;
	GCMoneySend(tObj->m_Index, Zen);
	if (gObj == tObj)
	{
		TNotice.MessageLog(1,tObj, "[SetZen] Your zen was edited!");
	}
	else
	{
		TNotice.MessageLog(1,gObj, "[SetZen] You successfully changed %s zen.", tObj->Name);
		TNotice.MessageLog(1,tObj, "[SetZen] Your zen was edited by %s!", gObj->Name);
	}
	return true;
}			
Пример #23
0
void MyObjCalCharacter(int aIndex)
{
     OBJECTSTRUCT * lpObj = (OBJECTSTRUCT*) OBJECT_POINTER (aIndex);
     // -----
     gObjCalCharacter(aIndex);
     // -----
     if(lpObj->pInventory[8].m_Type == 0x1A50) //Panda
     {
          lpObj->m_Defense                  += Config.Panda.PetPandaDefense;
          lpObj->m_AttackDamageMinLeft		+= Config.Panda.PetPandaAttackDamageMinLeft;
          lpObj->m_AttackDamageMaxLeft		+= Config.Panda.PetPandaAttackDamageMaxLeft;
          lpObj->m_AttackDamageMinRight     += Config.Panda.PetPandaAttackDamageMinRight;
          lpObj->m_AttackDamageMaxRight     += Config.Panda.PetPandaAttackDamageMaxRight;
          lpObj->m_MagicDamageMin           += Config.Panda.PetPandaMagicDamageMin;
          lpObj->m_MagicDamageMax           += Config.Panda.PetPandaMagicDamageMax;
          lpObj->m_MagicSpeed               += Config.Panda.PetPandaMagicSpeed;
          lpObj->m_AttackSpeed              += Config.Panda.PetPandaAttackSpeed;
     }
   if(lpObj->pInventory[10].m_Type == 0x1A4C || lpObj->pInventory[11].m_Type == 0x1A4C) // Panda Ring
    {
         lpObj->m_Defense                   += Config.Panda.PandaRingDefense;
         lpObj->m_AttackDamageMinLeft		+= Config.Panda.PandaRingAttackDamageMinLeft;
         lpObj->m_AttackDamageMaxLeft		+= Config.Panda.PandaRingAttackDamageMaxLeft;
         lpObj->m_AttackDamageMinRight		+= Config.Panda.PandaRingAttackDamageMinRight;
         lpObj->m_AttackDamageMaxRight		+= Config.Panda.PandaRingAttackDamageMaxRight;
         lpObj->m_MagicDamageMin            += Config.Panda.PandaRingMagicDamageMin;
         lpObj->m_MagicDamageMax            += Config.Panda.PandaRingMagicDamageMax;
         lpObj->m_MagicSpeed                += Config.Panda.PandaRingMagicSpeed;
         lpObj->m_AttackSpeed               += Config.Panda.PandaRingAttackSpeed;	
    }
}
Пример #24
0
void CVipSystem::Load(int aIndex)
{
	OBJECTSTRUCT *pObj = (OBJECTSTRUCT*)OBJECT_POINTER(aIndex);
	if(this->m_Enabled == 1)
	{
		Vip[pObj[aIndex].m_Index - OBJECT_MIN] = MuDB.CheckVip(pObj->AccountID);
		ApplyVip(aIndex);
	}
}
Пример #25
0
void SQLClass::QuestUpdate(int aIndex,int iKillMob,int iMobCount,char *szQuestName,char *szQuestInfo)
{
	GOBJSTRUCT *gObj = (GOBJSTRUCT*)OBJECT_POINTER(aIndex);
	
	char szQueryBuff[1024];
	char szQueryBuff2[1024];
	char szQueryBuff3[1024];
	char szQueryBuff4[1024];
	char szQueryBuff5[1024];
	unsigned int MailMemoCount;
	unsigned int MailMemoTotal;
	unsigned int MemoGUID;

	wsprintfA(szQueryBuff, "SELECT MAX(MemoCount) AS MemoCount FROM T_FriendMain");
	PointsSql.Execute(szQueryBuff, &rsSql, true);
	rsSql.Fetch();
	MailMemoCount = rsSql.Values("MemoCount").ToIntegerU();
	rsSql.Close();

	MailMemoCount += 1;
	//Messages.outNormal(aIndex,"MailCount %d",MailMemoCount);

	wsprintfA(szQueryBuff2, "SELECT MemoTotal FROM T_FriendMain WHERE Name = '%s';", gObj->Name);
	PointsSql.Execute(szQueryBuff2, &rsSql, true);
	rsSql.Fetch();
	MailMemoTotal = rsSql.Values("MemoTotal").ToIntegerU();
	rsSql.Close();

	MailMemoTotal += 1;
	//Messages.outNormal(aIndex,"MemoTotal %d",MailMemoTotal);

	wsprintfA(szQueryBuff3, "SELECT GUID FROM T_FriendMain WHERE Name = '%s';", gObj->Name);
	PointsSql.Execute(szQueryBuff3, &rsSql, true);
	rsSql.Fetch();
	MemoGUID = rsSql.Values("GUID").ToIntegerU();
	rsSql.Close();
	//Messages.outNormal(aIndex,"GUID %d",MemoGUID);



	//Send Mail with Quest Info
	char QuestInfo[300];
	wsprintfA(QuestInfo,"Quest completed, go to Quest Manager for reward!");
	wsprintfA(szQueryBuff4, "INSERT INTO %s.dbo.T_FriendMail (MemoIndex,GUID,FriendName,wDate,Subject,bRead,Memo,Photo,Dir,Act) VALUES (%d,%d,'Manager',GetDate(),'%s',0,convert(varbinary(1000),'%s'),0x3006FF22222F1FFFC703FC0040F111110000,143,2)",m_SqlConn.sDatabase,MailMemoCount,MemoGUID,szQuestName,QuestInfo);
	PointsSql.Execute(szQueryBuff4, &rsSql, true);
	rsSql.Close();

	//Update Mail Count
	wsprintfA(szQueryBuff5, "UPDATE %s.dbo.T_FriendMain SET MemoCount='%d',MemoTotal='%d' WHERE Name='%s'",m_SqlConn.sDatabase,MailMemoCount,MailMemoTotal,gObj->Name);
	PointsSql.Execute(szQueryBuff5, &rsSql, true);
	rsSql.Close();
	
	//Update Mail
	FriendMemoListReq(aIndex);

}
Пример #26
0
void print_tree(struct node_t *tree)
{
    struct node_t *it;
    save_depth(tree);
    for (it = object_tree_l_most_node(tree->obj.parent); it;
         it = object_tree_iterator_increment(tree->obj.parent,
                                             OBJECT_POINTER(it))) {
        print_node(it);
    }
}
Пример #27
0
//Post Global Messages : "/post"
void cChat::ChatGlobal(DWORD aIndex,char* msg)
{
	char* Name;
	Name = (char*)gObj_GetChar(aIndex,gObjNick);
	GOBJSTRUCT *gObj = (GOBJSTRUCT*)OBJECT_POINTER(aIndex);

	if(Config.IsPost==0)
	{
		GCServerMsgStringSend(MSG01,aIndex,1);
		return;
	}

	else if(!strcmpi("/post ",msg))
	{
		GCServerMsgStringSend(MSG02,aIndex,1);
		Log.outError("[POST] [%s]: [%s] syntax error \n",gObj->AccountID,Name);
		return;
	}

	else if(strlen(msg)<1)
	{
		GCServerMsgStringSend(MSG03,aIndex,1);
		Log.outError("[POST] [%s]: [%s] syntax error \n",gObj->AccountID,Name);
		return;
	}

	else if((int)gObj_GetLevel(aIndex)<Config.PostLevel)
	{
		char levelmsg[120];
		sprintf_s(levelmsg,MSG04,Config.PostLevel);
		GCServerMsgStringSend(levelmsg,aIndex,1);
		Log.outError("[POST] [%s]: [%s] not enought Level \n",gObj->AccountID,Name);
		return;
	}
	
	else if(gObj->Money < Config.PostCost)
	{
		char OutputZenLack[120]={0};
		sprintf(OutputZenLack,MSG05,Config.PostCost);
		GCServerMsgStringSend(OutputZenLack,aIndex,1);
		Log.outError("[POST] [%s]: [%s] not enought Zend \n",gObj->AccountID,Name);
		return;
	}
	

	char Buff[255]={0};
	gObj->Money = gObj->Money - Config.PostCost;
	GCMoneySend(aIndex,gObj->Money);
	ServerMsgSend(0,1,Name,MSG06,msg);
	Log.outNormal("[POST] %s : %s \n",Name,msg);
	conLog.ConsoleOutputDT("[POST] %s : %s",Name,msg);
	sprintf(Buff,"[POST]: %s : %s",Name,msg);
	cWriteLog(Buff);
}
Пример #28
0
/**
 * parse each widget
 *
 * @param w: pointer to widget
 * @param m: no use
 * @return: NULL
 **/
static struct widget* do_parse_widget(struct widget* w, union message* m)
{
    NOT_USED(m);
    /**
     * record focusable widget
     **/
    if(w->input_enable == 1)
    {
        list_push_back(&global_application.focus_list, &w, sizeof(w));
    }

    /**
     * register window and update active window
     **/
    if(w->is_window)
    {
        struct window* parent = (struct window*)object_parent(OBJECT_POINTER(w));
		struct window* window_ptr = WINDOW_POINTER(w);
		si_t parent_descriptor = (parent == NULL ? 0 : parent->descriptor);
		si_t window_descriptor = register_window(parent_descriptor, window_ptr->title, 
				window_ptr->area.x, window_ptr->area.y, window_ptr->area.width, window_ptr->area.height, 
				window_ptr->minimize_enable, window_ptr->maximize_enable, window_ptr->modal);
		if(0 == window_descriptor)
		{
			EGUI_PRINT_ERROR("failed to register window %s", window_ptr->title);
			return NULL;
		}
		window_ptr->descriptor = window_descriptor;
        global_application.focus = window_ptr;

        /**
         * find icon for the application
         **/
        if((window_ptr->icon_path = (char*)malloc(256)) == NULL)
        {
			EGUI_PRINT_ERROR("failed to register window");
			return NULL;
        }
        else
        {
            /**
             * in C89 standard, snprintf() is NOT included in <stdio.h>
             * so you have to use sprintf, which may be dangerous. be careful
             **/
            sprintf(window_ptr->icon_path, "%s/icons/%s.bmp", global_application.icon_root_path, global_application.name);
            if(access(window_ptr->icon_path, R_OK) == -1)
            {
                sprintf(window_ptr->icon_path, "%s/icons/default.bmp", global_application.icon_root_path);
            }
        }
    }

    return NULL;
}
bool cProtoFunc::CGPartyRequestRecv(PMSG_PARTYREQUEST * lpMsg, int aIndex)
{	
	int number =  MAKE_NUMBERW(lpMsg->NumberH, lpMsg->NumberL);

	OBJECTSTRUCT *gObj = (OBJECTSTRUCT*)OBJECT_POINTER(aIndex);	 
	OBJECTSTRUCT *pObj = (OBJECTSTRUCT*)OBJECT_POINTER(number);
																			 
	if(gObj->Level > pObj->Level && gObj->Level - pObj->Level >= Config.PartyGapLvl)
	{	
		Chat.MessageLog(1, cLog.c_Red, cLog.t_Default, gObj, "[Party] You can't stay with %s in party! %s needs %d more lvl.", pObj->Name, pObj->Name, gObj->Level-Config.PartyGapLvl - pObj->Level);
		return true;
	}

	if(gObj->Level < pObj->Level && pObj->Level - gObj->Level >= Config.PartyGapLvl)
	{																													
		Chat.MessageLog(1, cLog.c_Red, cLog.t_Default, gObj, "[Party] You can't stay with %s in party! You need %d more lvl.", pObj->Name, pObj->Level - Config.PartyGapLvl - gObj->Level);
		return true;
	}	   
	return false;
}
Пример #30
0
/*
   如果 window 有左子节点
   那么这个左子节点并不是 window 子对象
   所以在析构以 window 为根的树之前一定要要将 window->lchild 成员清空

   如果 window 在对象树中
   那么完成删除工作后一定要更新 root->parent 的 lchild 成员和 rchild 成员
   这是为了保证遍历的正确
   */
si_t application_del_window(struct window * window)
{
	si_t is_top_window = 0;

	/* 删除主窗口 */
	/* 退出程序 */
	if(window == global_application.main_window)
	{
		application_exit();
		return 0;
	}

	if(window->parent->parent == OBJECT_POINTER(window))
	{
		is_top_window = 1;
	}

	cancel_window(window->descriptor);

	object_delete(OBJECT_POINTER(window), __widget_destructor);
	if(is_top_window)
	{
		si_t i = 0, n = 0;
		/* 有多少个窗口 */
		n = vector_size(&(global_application.window_vector));

		/* 找到这个窗口在向量中的索引 */
		for(i = 0; i < n; ++ i)
		{
			struct object* tree = vector_at(&(global_application.window_vector), i);
			if(tree->parent == OBJECT_POINTER(window))
			{
				/* 从窗口向量中删除这个节点 */
				vector_erase(&(global_application.window_vector), i);
				break;
			}
		}
	}

	return 0;
}